Hi Alexandre,
Ivan found that on Windows .exe's can export functions, just like DLLs. He needs this for his work on ntoskrnl.exe.
To support this, we need a bit of an interface change to winebuild. I've put together a simple patch to see if you are OK with such a change. If so, I'll finish it, and modify winegcc accordingly.
So, thing will change as follows:
OLD: winebuild --dll=mystuff.spec NEW: winebuild --dll -E mystuff.spec
OLD: winebuild --def=mystuff.spec NEW: winebuild --def -E mystuff.spec
OLD: winebuild --exe=myprog.exe NEW: winebuild --exe -F myprog.exe
to build an .exe with arbitrary exports, we would do:
winebuild --exe -F myprog.exe -E mystuff.spec
Index: tools/winebuild/main.c =================================================================== RCS file: /var/cvs/wine/tools/winebuild/main.c,v retrieving revision 1.59 diff -u -r1.59 main.c --- tools/winebuild/main.c 7 Dec 2004 17:19:54 -0000 1.59 +++ tools/winebuild/main.c 7 Mar 2005 01:50:44 -0000 @@ -144,6 +144,7 @@ " -C --source-dir=DIR Look for source files in DIR\n" " -d --delay-lib=LIB Import the specified library in delayed mode\n" " -D SYM Ignored for C flags compatibility\n" +" -E --export=FILE Export the symbols defined in the .spec or .def file\n" " -e --entry=FUNC Set the DLL entry point function (default: DllMain)\n" " -f FLAGS Compiler flags (only -fPIC is supported)\n" " -F --filename=DLLFILE Set the DLL filename (default: from input file name)\n" @@ -165,9 +166,9 @@ " --version Print the version and exit\n" " -w --warnings Turn on warnings\n" "\nMode options:\n" -" --dll=FILE Build a .c file from a .spec or .def file\n" -" --def=FILE.SPEC Build a .def file from a spec file\n" -" --exe=NAME Build a .c file for the named executable\n" +" --dll Build a .c file from a .spec or .def file\n" +" --def Build a .def file from a spec file\n" +" --exe Build a .c file for the named executable\n" " --debug [FILES] Build a .c file with the debug channels declarations\n" " --relay16 Build the 16-bit relay assembly routines\n" " --relay32 Build the 32-bit relay assembly routines\n\n" @@ -204,6 +205,7 @@ /* aliases for short options */ { "source-dir", 1, 0, 'C' }, { "delay-lib", 1, 0, 'd' }, + { "export", 1, 0, 'E' }, { "entry", 1, 0, 'e' }, { "filename", 1, 0, 'F' }, { "help", 0, 0, 'h' }, @@ -248,6 +250,10 @@ case 'D': /* ignored */ break; + case 'E': + spec_file_name = xstrdup( optarg ); + set_dll_file_name( optarg, spec ); + break; case 'F': spec->file_name = xstrdup( optarg ); break; @@ -324,21 +330,12 @@ break; case LONG_OPT_DLL: set_exec_mode( MODE_DLL ); - spec_file_name = xstrdup( optarg ); - set_dll_file_name( optarg, spec ); break; case LONG_OPT_DEF: set_exec_mode( MODE_DEF ); - spec_file_name = xstrdup( optarg ); - set_dll_file_name( optarg, spec ); break; case LONG_OPT_EXE: set_exec_mode( MODE_EXE ); - if ((p = strrchr( optarg, '/' ))) p++; - else p = optarg; - spec->file_name = xmalloc( strlen(p) + 5 ); - strcpy( spec->file_name, p ); - if (!strchr( spec->file_name, '.' )) strcat( spec->file_name, ".exe" ); if (!spec->subsystem) spec->subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI; break; case LONG_OPT_DEBUG:
"Dimitrie O. Paun" dpaun@rogers.com writes:
To support this, we need a bit of an interface change to winebuild. I've put together a simple patch to see if you are OK with such a change. If so, I'll finish it, and modify winegcc accordingly.
Looks good to me.