Don't make the spec file constructors static so that they don't get

optimized out.
This commit is contained in:
Alexandre Julliard 2000-12-06 20:18:35 +00:00
parent 447ddfd37d
commit 9fd831f68a
2 changed files with 31 additions and 27 deletions

View File

@ -771,18 +771,20 @@ void BuildSpec16File( FILE *outfile )
/* Output the DLL constructor */
fprintf( outfile, "#ifdef __GNUC__\n" );
fprintf( outfile, "static void init(void) __attribute__((unused));\n" );
fprintf( outfile, "#else /* defined(__GNUC__) */\n" );
fprintf( outfile, "static void __asm__dummy_dll_init(void) {\n" );
fprintf( outfile, "#endif /* defined(__GNUC__) */\n" );
fprintf( outfile, "asm(\"\\t.section\t.init ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall init\\n\"\n" );
fprintf( outfile, " \"\\t.previous\\n\");\n" );
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif /* defined(__GNUC__) */\n" );
fprintf( outfile, "static void init(void) { __wine_register_dll_16( &descriptor ); }\n" );
fprintf( outfile,
"#ifndef __GNUC__\n"
"static void __asm__dummy_dll_init(void) {\n"
"#endif /* defined(__GNUC__) */\n"
"asm(\"\\t.section\t.init ,\\\"ax\\\"\\n\"\n"
" \"\\tcall " PREFIX "__wine_spec_%s_init\\n\"\n"
" \"\\t.previous\\n\");\n"
"#ifndef __GNUC__\n"
"}\n"
"#endif /* defined(__GNUC__) */\n\n"
"void __wine_spec_%s_init(void)\n"
"{\n"
" __wine_register_dll_16( &descriptor );\n"
"}\n", DLLName, DLLName );
}

View File

@ -670,38 +670,40 @@ void BuildSpec32File( FILE *outfile )
/* Output the DLL constructor */
fprintf( outfile, "#ifdef __GNUC__\n" );
fprintf( outfile, "static void init(void) __attribute__((unused));\n" );
if (nr_debug)
fprintf( outfile, "static void fini(void) __attribute__((unused));\n" );
fprintf( outfile, "#else /* defined(__GNUC__) */\n" );
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "static void __asm__dummy_dll_init(void) {\n" );
fprintf( outfile, "#endif /* defined(__GNUC__) */\n" );
fprintf( outfile, "asm(\"\\t.section\t.init ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall init\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "__wine_spec_%s_init\\n\"\n", DLLName );
fprintf( outfile, " \"\\t.previous\\n\");\n" );
if (nr_debug)
{
fprintf( outfile, "asm(\"\\t.section\t.fini ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall fini\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "__wine_spec_%s_fini\\n\"\n", DLLName );
fprintf( outfile, " \"\\t.previous\\n\");\n" );
}
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif /* defined(__GNUC__) */\n\n" );
fprintf( outfile, "static void init(void)\n{\n" );
fprintf( outfile, " extern void __wine_dll_register( const struct image_nt_headers *, const char * );\n" );
fprintf( outfile, " extern void *__wine_dbg_register( char * const *, int );\n");
fprintf( outfile, " __wine_dll_register( &nt_header, \"%s\" );\n", DLLFileName );
fprintf( outfile,
"void __wine_spec_%s_init(void)\n"
"{\n"
" extern void __wine_dll_register( const struct image_nt_headers *, const char * );\n"
" extern void *__wine_dbg_register( char * const *, int );\n"
" __wine_dll_register( &nt_header, \"%s\" );\n",
DLLName, DLLFileName );
if (nr_debug)
fprintf( outfile, " debug_registration = __wine_dbg_register( debug_channels, %d );\n",
nr_debug );
fprintf( outfile, "}\n" );
if (nr_debug)
{
fprintf( outfile, "\nstatic void fini(void)\n{\n" );
fprintf( outfile, " extern void __wine_dbg_unregister( void * );\n");
fprintf( outfile, " __wine_dbg_unregister( debug_registration );\n" );
fprintf( outfile, "}\n" );
fprintf( outfile,
"\nvoid __wine_spec_%s_fini(void)\n"
"{\n"
" extern void __wine_dbg_unregister( void* );\n"
" __wine_dbg_unregister( debug_registration );\n"
"}\n", DLLName );
}
}