Support for disabling symbols import in WineBuild based on a prefix.

Pierre d'Herbemont stegefin at free.fr
Sun Aug 22 06:10:13 CDT 2004


Hi,

The problem which can happen when we want to use an API which defines 
symbols which has the same name that a Win32 symbol's name is that 
winebuild assume that it is a Win32 symbol in any case. For instance 
when doing the quartzdrv for Mac OS X, Rib faced with Carbon's API. The 
ShowWindow Call was forwarded to the Wine's ShowWindow function, 
whereas it should have been Carbon's one. I don't know if there is any 
simpler or smarter solution for that, but here is one. For all the 
Carbon's calls add a "CARBON_" prefix, and then have winebuild to 
translate those call.

Tell me if you want any modification on it, or if you prefer to do it 
using an other way.

Thanks!

Pierre

ChangeLog:
- Add support for symbols name collision between Win32's symbols name 
and Mac OS X Carbon's symbols name.

-------------- next part --------------
Index: import.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/import.c,v
retrieving revision 1.68
diff -u -r1.68 import.c
--- import.c	29 Jul 2004 02:34:15 -0000	1.68
+++ import.c	22 Aug 2004 11:08:09 -0000
@@ -574,6 +574,36 @@
     }
     if ((err = pclose( f ))) warning( "nm -u %s error %d\n", name, err );
 }
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+/* every functions whose name begin with prefix will be skipped and an
+   implementation for this function is created. The implementation call the
+   function without the prefix. It is especially useful when we have a system
+   symbol (let's say Carbon's ShowWindow on Mac OS X)  which is also defined
+   by Wine's Win32 implemenation. */
+void output_host_system_symbols(FILE *outfile)
+{
+    const char prefix[] = "CARBON_";
+    int i;
+
+    for (i = 0; i < nb_undef_symbols; i++)
+    {
+        char * function_name = strstr(undef_symbols[i], prefix);
+
+        if (function_name)
+        {
+            function_name += strlen(prefix);
+            fprintf( outfile, "extern void %s(void);\n", function_name );
+            fprintf( outfile, "void %s%s(void)\n", prefix, function_name );
+            fprintf( outfile, "{\n" );
+            fprintf( outfile, "  %s();\n", function_name );
+            fprintf( outfile, "}\n" );
+            free( undef_symbols[i] );
+            undef_symbols[i] = NULL;
+        }
+    }
+    remove_symbol_holes();
+}
 
 static void remove_ignored_symbols(void)
 {
Index: spec32.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.83
diff -u -r1.83 spec32.c
--- spec32.c	15 Jul 2004 18:58:42 -0000	1.83
+++ spec32.c	22 Aug 2004 11:08:10 -0000
@@ -507,6 +507,8 @@
     resolve_imports( spec );
     output_standard_file_header( outfile );
 
+    output_host_system_symbols( outfile );
+
     /* Reserve some space for the PE header */
 
     fprintf( outfile, "extern char __wine_spec_pe_header[];\n" );


More information about the wine-patches mailing list