From: Max B. <ba...@uc...> - 2003-08-27 01:43:22
|
Hi, all. I have an MSVC-compiled executable. Let's call it super.exe. super.exe dynamically loads a DLL called ui/uix86.dll from its working directory. It expects uix86.dll to export two functions: dll_init and main_vm. They are both exported with __cdecl. I am trying to use MinGW/MSYS to produce such a dll. Compiling my code for uix86 into object files is a piece of cake. Linking them into a usable DLL is not. First of all, here is the .def file I'm using to make the DLL: EXPORTS main_vm dll_init Quite simple. I have looked here: http://mywebpage.netscape.com/yongweiwu/stdcall.htm and here: http://www.mingw.org/mingwfaq.shtml#faq-msvcdll After reading these and searching the mailing list archives as well as sourceforge would let me, I've been trying to produce the DLL using this command: dllwrap --def ui.def -o pathtosuper/ui/uix86.dll *.o Problem is, super.exe simply fails to load the resulting DLL. After looking at that first webpage, I figured that there shouldn't be any problems with exported function names (_'s and @'s and such) since my two functions are using the __cdecl calling convention. But I've tried the -k and --add-stdcall-alias options to dllwrap just in case. No difference as far as super.exe is concerned. So I used depends.exe (www.dependencywalker.com) to look at my uix86.dll and compare it to an example DLL that I know works with super.exe. The exported function names are exactly the same in both, as are their ordinal numbers. However, I noticed the following differences: Their Hint #'s are swapped, my dll has subsystem Console rather than GUI, and the example DLL has a link checksum of zero, whereas my DLL's link checksum is non-zero and equals my Real Checksum. So are any of these differences enough to explain why it isn't working? If so, how can I fix that up? If not, what do I need to change in the way I'm generating my DLL? I tried following that FAQ question I linked to above, but it doesn't help me at all -- first of all, I don't have the source to super.exe, and I need to make a DLL it can link to at runtime, NOT a .lib (I assume this is the windows equiv of .a files?) it can link to at compile time. Basically, I'm a total noob to making DLLs and Windows programs in general -- I'm really a unix/linux programmer who has to write something for windows, and would much rather use a familiar/portable build environment like MinGW rather than shell out for MSVC. Thanks for any help, guys (and gals). -- Max Bane |