[PATCH] winemaker-bugs.diff

Martin Wilck Martin.Wilck at Fujitsu-Siemens.com
Fri Sep 6 11:52:37 CDT 2002


This is the first and most important of my winemaker fixes.
Without this patch, trying to compile a wrapped console app with
winemaker fails just miserably.

Patch: winemaker-bugs.diff

Martin Wilck <Martin.Wilck at fujitsu-siemens.com>

Modified files:

tools:        winemaker
        - Add "-ldl" for wrapper apps 
        - fix Makefile for --wrap
        - Fix wrapper code which was broken for console apps                

This patch is incremental over Francois Gouget's latest winemaker patch:
http://www.winehq.com/hypermail/wine-patches/2002/09/0028.html

--- CVS/wine/tools/winemaker	Fri Sep  6 17:33:24 2002
+++ TMP/wine/tools/winemaker	Fri Sep  6 17:34:30 2002
@@ -986,6 +986,7 @@
 	@$wrapper[$T_INIT]=get_default_init(@$target[$T_TYPE]);
 	@$wrapper[$T_FLAGS]=$TF_WRAPPER | (@$target[$T_FLAGS] & $TF_MFC);
 	@$wrapper[$T_DLLS]=[ "kernel32.dll", "ntdll.dll", "user32.dll" ];
+	push @{@$wrapper[$T_LIBRARIES]}, "dl";
 	push @{@$wrapper[$T_SOURCES_C]},"@$wrapper[$T_NAME]_wrapper.c";
 
 	my $index=bsearch(@$target[$T_SOURCES_C],"@$wrapper[$T_NAME]_wrapper.c");
@@ -1624,7 +1625,7 @@
 
   # Don't forget to export the 'Main' function for wrapped executables,
   # except for MFC ones!
-  if (@$target[$T_FLAGS] == $TF_WRAP) {
+  if ((@$target[$T_FLAGS]&($TF_WRAP|$TF_WRAPPER|$TF_MFC)) == $TF_WRAP) {
     if (@$target[$T_TYPE] == $TT_GUIEXE) {
       print FILEO "\n@ stdcall @$target[$T_INIT](long long ptr long) @$target[$T_INIT]\n";
     } elsif (@$target[$T_TYPE] == $TT_CUIEXE) {
@@ -1830,7 +1831,11 @@
       } elsif (@$target[$T_FLAGS] & $TF_WRAPPER) {
 	$basename.="_wrapper";
       }
-      generate_list("${canon}_SPEC_SRCS",1,[ "$basename.exe.spec" ]);
+      if (@$target[$T_TYPE] != $TT_DLL) {
+        generate_list("${canon}_SPEC_SRCS",1,[ "$basename.exe.spec" ]);
+      } else {
+        generate_list("${canon}_SPEC_SRCS",1,[ "$basename.spec" ]);
+      }
       generate_list("${canon}_DLL_PATH",1,@$target[$T_DLL_PATH]);
       generate_list("${canon}_DLLS",1,@$target[$T_DLLS]);
       generate_list("${canon}_LIBRARY_PATH",1,@$target[$T_LIBRARY_PATH]);
@@ -3154,6 +3159,8 @@
  * This is either CUIEXE for a console based application or
  * GUIEXE for a regular windows application.
  */
+#define GUIEXE 0
+#define CUIEXE 1
 #define      APP_TYPE      ##WINEMAKER_APP_TYPE##
 
 /**
@@ -3198,11 +3205,11 @@
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
 #else
-int WINAPI Main(int argc, char** argv, char** envp)
+int WINAPI main(int argc, char** argv, char** envp)
 #endif
 {
     void* appLibrary;
-    HINSTANCE hApp,hMFC,hMain;
+    HINSTANCE hApp = 0, hMFC = 0, hMain = 0;
     void* appMain;
     char* libName;
     int retcode;
@@ -3272,7 +3279,7 @@
     }
 
     /* Get the address of the application's entry point */
-    appMain=(WinMainFunc*)GetProcAddress(hMain, appInit);
+    appMain=GetProcAddress(hMain, appInit);
     if (appMain==NULL) {
         char format[]="Could not get the address of %s (%d)";
         char* msg;


-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy








More information about the wine-patches mailing list