[winegcc06] Delayed import

Richard Cohen richard.cohen at virgin.net
Wed Aug 13 21:08:34 CDT 2003


After this patch, everything in programs/ can be built with winegcc.

I plan to add a -no-script option to winewrap to stop it generating a 
wrapping shell script (unless there are any alternative suggestions)


Changelog:
	Add support for delayed import (-d) in winegcc/winewrap.
-------------- next part --------------
diff -u -r tools.5/winegcc.c tools/winegcc.c
--- tools.5/winegcc.c	2003-08-14 00:55:07.000000000 +0100
+++ tools/winegcc.c	2003-08-14 01:21:41.000000000 +0100
@@ -193,7 +193,8 @@
 		    }
 		    argv[j] = 0;
 		    break;
-		case 'l':
+		case 'l': /* import/static library */
+		case 'd': /* delayed import library */
 		    strarray_add(gcc_argv, strcmp(argv[j], "-luuid") ? argv[j] : "-lwine_uuid"); 
 		    argv[j] = 0;
 		    break;
diff -u -r tools.5/winewrap.c tools/winewrap.c
--- tools.5/winewrap.c	2003-08-14 01:09:55.000000000 +0100
+++ tools/winewrap.c	2003-08-14 02:02:53.000000000 +0100
@@ -218,7 +218,7 @@
 static int keep_generated = 0;
 
 static char *output_name;
-static strarray *arh_files, *dll_files, *lib_files, *lib_paths, *obj_files;
+static strarray *arh_files, *ddll_files, *dll_files, *lib_files, *llib_paths, *lib_paths, *obj_files;
 
 void rm_temp_file(const char *file)
 {
@@ -321,9 +321,20 @@
 
 void add_lib_path(const char* path)
 {
-    strarray_add(lib_paths,strdup(path));
-    strarray_add(dll_files, strmake("-L%s", path));
-    strarray_add(lib_files, strmake("-L%s", path));
+    strarray_add(lib_paths, strdup(path));
+    strarray_add(llib_paths, strmake("-L%s", path));
+}
+
+void add_delaylib_file(const char* library)
+{
+    if (find_dll(library))
+    {
+        strarray_add(ddll_files,  strmake("-d%s", library));
+    }
+    else
+    {
+	error("DLL %s not found", library);
+    }
 }
 
 void add_lib_file(const char* library)
@@ -356,9 +367,11 @@
     strarray *wwrap_args, *wspec_args, *wcomp_args, *wlink_args;
    
     strarray_init(arh_files);
+    strarray_init(ddll_files);
     strarray_init(dll_files);
     strarray_init(lib_files);
     strarray_init(lib_paths);
+    strarray_init(llib_paths);
     strarray_init(obj_files);
     
     /* include the standard DLL path first */
@@ -390,6 +403,12 @@
 		else error("The -l switch takes an argument\n.");
 		add_lib_file(library);
 		break;
+	    case 'd':
+		if (argv[i][2]) library = argv[i] + 2;
+		else if (i + 1 < argc) library = argv[++i];
+		else error("The -d switch takes an argument\n.");
+		add_delaylib_file(library);
+		break;
 	    case 'm':
 		if (strcmp("-mgui", argv[i]) == 0) gui_mode = 1;
 		else error("Unknown option %s\n", argv[i]);
@@ -478,6 +497,11 @@
 	strarray_add(spec_args, strmake("%s.exe", base_name));
         strarray_add(spec_args, gui_mode ? "-mgui" : "-mcui");
     }
+
+    for (i = 0; i < llib_paths->size; i++)
+	strarray_add(spec_args, llib_paths->base[i]);
+    for (i = 0; i < ddll_files->size; i++)
+	strarray_add(spec_args, ddll_files->base[i]);
     for (i = 0; i < dll_files->size; i++)
 	strarray_add(spec_args, dll_files->base[i]);
     for (i = 0; i < obj_files->size; i++)
@@ -503,6 +527,8 @@
     strarray_add(link_args, "-Wl,-Bsymbolic,-z,defs");
     strarray_add(link_args, "-lwine");
     strarray_add(link_args, "-lm");
+    for (i = 0; i < llib_paths->size; i++)
+	strarray_add(link_args, llib_paths->base[i]);
     for (i = 0; i < lib_files->size; i++)
 	strarray_add(link_args, lib_files->base[i]);
     strarray_add(link_args, "-o");
@@ -539,6 +565,10 @@
     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]);
+    for (i = 0; i < ddll_files->size; i++)
+	strarray_add(wspec_args, ddll_files->base[i]);
     for (i = 0; i < dll_files->size; i++)
 	strarray_add(wspec_args, dll_files->base[i]);
     strarray_add(wspec_args, NULL);


More information about the wine-patches mailing list