winewrap: fix wrapper linking

Dimitrie O. Paun dpaun at rogers.com
Tue Jan 6 23:45:51 CST 2004


Richard,

You patch from Nov 28:
   http://www.winehq.org/hypermail/wine-cvs/2003/11/0299.html
says (among other things):
   "Compiling with -lwine needs to use the given -L paths."

In other words, it adds all the -Lxxx libs to the linking step
for the wrapper. I see no reason to do so. At the Windows/DLL
level, we only link with kernel32, and we know exactly where
it is: in DLLDIR. At the Linux/ELF level, we only link with
-lwine, and similarly, we know it resides in LIBDIR.

Anything against this patch?

ChangeLog
    Do not fail if we can't load some libs in the wrapper.
    No need to link the wrapper with all libs, we know what we need.

Index: tools/winegcc/winewrap.c
===================================================================
RCS file: /var/cvs/wine/tools/winegcc/winewrap.c,v
retrieving revision 1.11
diff -u -r1.11 winewrap.c
--- tools/winegcc/winewrap.c	3 Dec 2003 03:58:52 -0000	1.11
+++ tools/winegcc/winewrap.c	7 Jan 2004 05:22:20 -0000
@@ -187,7 +187,8 @@
     "    }\n"
     "\n"
     "    for (i = 0; i < sizeof(libs)/sizeof(libs[0]); i++) {\n"
-    "        if (!LoadLibrary(libs[i])) error(\"Could not load %%s (%%d)\", libs[i], GetLastError());\n"
+    "        if (!LoadLibrary(libs[i])) \n"
+    "            fprintf(stderr, \"Warning: Could not load %%s (%%d)\\n\", libs[i], GetLastError());\n"
     "    }\n"
     "\n"
     "    /* Load the application's module */\n"
@@ -395,8 +396,7 @@
     strarray_add(wspec_args, strmake("%s.exe", base_name));
     strarray_add(wspec_args, gui_mode ? "-mgui" : "-mcui");
     strarray_add(wspec_args, wrap_o_name);
-    for (i = 0; i < llib_paths->size; i++)
-	strarray_add(wspec_args, llib_paths->base[i]);
+    strarray_add(wspec_args, "-L" DLLDIR);
     strarray_add(wspec_args, "-lkernel32");
     strarray_add(wspec_args, NULL);
 
@@ -422,13 +422,12 @@
     strarray_add(wlink_args, "gcc");
     strarray_add(wlink_args, "-shared");
     strarray_add(wlink_args, "-Wl,-Bsymbolic,-z,defs");
-    strarray_add(wlink_args, "-lwine");
     strarray_add(wlink_args, "-o");
     strarray_add(wlink_args, strmake("%s.exe.so", base_file));
+    strarray_add(wlink_args, "-L" LIBDIR);
+    strarray_add(wlink_args, "-lwine");
     strarray_add(wlink_args, wspec_o_name);
     strarray_add(wlink_args, wrap_o_name);
-    for (i = 0; i < llib_paths->size; i++)
-	strarray_add(wlink_args, llib_paths->base[i]);
     strarray_add(wlink_args, NULL);
 
     spawn(wlink_args);


-- 
Dimi.




More information about the wine-patches mailing list