[Darwine] Weak Import and Darwin
Pierre d'Herbemont
stegefin at free.fr
Wed Jul 14 14:20:43 CDT 2004
Sorry it was the wrong patch :(
-------------- next part --------------
Index: tools/winebuild/spec32.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.82
diff -u -r1.82 spec32.c
--- tools/winebuild/spec32.c 17 Jun 2004 19:58:59 -0000 1.82
+++ tools/winebuild/spec32.c 14 Jul 2004 19:20:28 -0000
@@ -76,16 +76,18 @@
*
* Output a prototype for a weak function.
*/
-static void declare_weak_function( FILE *outfile, const char *name, const char *prototype )
+static void declare_weak_function( FILE *outfile, const char *ret_type, const char *name, const char *params)
{
fprintf( outfile, "#ifdef __GNUC__\n" );
fprintf( outfile, "# ifdef __APPLE__\n" );
- fprintf( outfile, "extern %s __attribute__((weak_import));\n", prototype );
+ fprintf( outfile, "extern %s %s(%s) __attribute__((weak_import));\n", ret_type, name, params );
+ fprintf( outfile, "static %s (*_wine_weak_%s)(%s) = %s;\n", ret_type, name, params, name );
+ fprintf( outfile, "#define %s _wine_weak_%s\n", name, name );
fprintf( outfile, "# else\n" );
- fprintf( outfile, "extern %s __attribute__((weak));\n", prototype );
+ fprintf( outfile, "extern %s %s(%s) __attribute__((weak));\n", ret_type, name, params );
fprintf( outfile, "# endif\n" );
fprintf( outfile, "#else\n" );
- fprintf( outfile, "extern %s;\n", prototype );
+ fprintf( outfile, "extern %s %s(%s);\n", ret_type, name, params );
fprintf( outfile, "static void __asm__dummy_%s(void)", name );
fprintf( outfile, " { asm(\".weak " __ASM_NAME("%s") "\"); }\n", name );
fprintf( outfile, "#endif\n\n" );
@@ -600,8 +602,7 @@
fprintf( outfile, "extern int __stdcall %s( void*, unsigned int, void* );\n\n", init_func );
else
{
- declare_weak_function( outfile, "DllMain",
- "int __stdcall DllMain( void*, unsigned int, void* )" );
+ declare_weak_function( outfile, "int __stdcall", "DllMain", "void*, unsigned int, void*" );
init_func = "DllMain";
}
fprintf( outfile,
@@ -624,8 +625,7 @@
fprintf( outfile, "extern int __stdcall %s( void*, void* );\n\n", init_func );
else
{
- declare_weak_function( outfile, "DriverEntry",
- "int __stdcall DriverEntry( void*, void* )" );
+ declare_weak_function( outfile, "int __stdcall", "DriverEntry", "void*, void*");
init_func = "DriverEntry";
}
fprintf( outfile,
@@ -647,9 +647,9 @@
fprintf( outfile, "extern int %s( int argc, char *argv[] );\n", init_func );
else
{
- declare_weak_function( outfile, "main", "int main( int argc, char *argv[] )" );
- declare_weak_function( outfile, "wmain", "int wmain( int argc, unsigned short *argv[] )" );
- declare_weak_function( outfile, "WinMain", "int __stdcall WinMain(void *,void *,char *,int)" );
+ declare_weak_function( outfile, "int", "main", "int argc, char *argv[]" );
+ declare_weak_function( outfile, "int", "wmain", "int argc, unsigned short *argv[]" );
+ declare_weak_function( outfile, "int __stdcall", "WinMain", "void *,void *,char *,int" );
}
fprintf( outfile,
"\ntypedef struct {\n"
-------------- next part --------------
Le 14 juil. 04, ? 15:46, Pierre d'Herbemont a ?crit :
> Hi!
>
> Weak import on darwin doesn't work as we would like it to work. (or it
> is buggy). Here is a work around which makes Wine working on Mac OS X
> without disabling the __wine_* init functions.
>
> Thanks,
>
> Pierre.
>
> ChangeLog:
> Darwin/Mac OS X Weak import workaround.
>
More information about the wine-patches
mailing list