15 dim as ASTNODE
ptr main =
any
29 dim as FBSYMBOL
ptr proc =
any, label =
any, param =
any
34 symbAddProcParam( proc,
"__FB_DLLINSTANCE__", typeAddrOf( FB_DATATYPE_VOID ), NULL, _
35 FB_PARAMMODE_BYVAL, 0 )
38 param =
symbAddProcParam( proc,
"__FB_DLLREASON__", FB_DATATYPE_UINT, NULL, _
39 FB_PARAMMODE_BYVAL, 0 )
42 symbAddProcParam( proc,
"__FB_DLLRESERVED__", typeAddrOf( FB_DATATYPE_VOID ), NULL, _
43 FB_PARAMMODE_BYVAL, 0 )
47 proc =
symbAddProc( proc, NULL,
"DllMain", FB_DATATYPE_INTEGER, NULL, _
48 FB_SYMBATTRIB_PUBLIC, env.target.
stdcall, FB_SYMBOPT_DECLARING )
57 param = symbGetParamVar( param )
62 label, AST_OPOPT_NONE ) )
75 dim as FBSYMBOL
ptr proc =
any
79 FB_SYMBATTRIB_PRIVATE, FB_FUNCMODE_CDECL, FB_SYMBOPT_DECLARING )
91 dim as FBSYMBOL
ptr proc =
any
97 FB_PARAMMODE_BYVAL, 0 )
100 symbAddProcParam( proc,
"__FB_ARGV__", typeMultAddrOf( FB_DATATYPE_CHAR, 2 ), NULL, _
101 FB_PARAMMODE_BYVAL, 0 )
104 var attrib = FB_SYMBATTRIB_PUBLIC
106 if( env.clopt.outtype = FB_OUTTYPE_DYNAMICLIB )
then
107 attrib = FB_SYMBATTRIB_PRIVATE
109 if( env.clopt.backend = FB_BACKEND_GCC )
then
115 env.main.proc =
symbAddProc( proc, NULL, id, FB_DATATYPE_LONG, NULL, _
116 attrib, FB_FUNCMODE_CDECL, FB_SYMBOPT_DECLARING )
119 symbSetIsMainProc( env.main.proc )
127 FB_SYMBATTRIB_PRIVATE, FB_FUNCMODE_CDECL, FB_SYMBOPT_DECLARING )
129 symbSetIsAccessed( env.main.proc )
130 symbSetIsModLevelProc( env.main.proc )
136 if( env.outf.ismain )
then
145 if( env.outf.ismain
and (env.clopt.outtype = FB_OUTTYPE_DYNAMICLIB) )
then
146 if( env.clopt.target = FB_COMPTARGET_WIN32 )
then
155 dim as integer callrtexit = FALSE
157 if( env.outf.ismain )
then
160 if( astGetFirstDataStmtSymbol( ) <> NULL )
then
164 callrtexit = (env.clopt.outtype <> FB_OUTTYPE_DYNAMICLIB)