One step at a time...
Now I've successfully included my stubbed dll into the wine tree.
When I try to link to it, however, I still get undefined references to what should be in the dll. I added my stubbed dll to the my_other_dll_DLLS section of the Makefile.in, just like it were a normal wine dll. Is that all I need to do to link to it?
When I run nm on my dll in /usr/local/lib/wine, it only lists entries like:
000131a4 T __wine_stub_mydll_dll_13
It doesn't list any of the exported functions that are listed in the spec file that winedump generated. Does wine automagically match up those stub statements with the exported symbols?
Does it matter that the dll is exporting C++ classes, not straight C functions?
-Steve
Hi Steve,
I upgraded my autoconf, which solved my first problem. Now, everything runs fine until I get to the make install step, when I get this error:
<snip>
The attached patch to winedump corrects the over-enthusiatic insertion of generated DLL entries into dlls/Makefile.in, and renames the MODULE from <dll> to <dll>.dll as per the current build process.
You can manually remove the offending lines youself, edit dlls/Makefile.in and remove the 2 lines referring to your DLL after the targets "uninstall::" and "install::". Then append".dll" to the MODULE = line in dlls/<yourdll>/Makefile.in. Alternately, apply the patch and regenerate.
I've just tested the process from start to finish and it works for me now. Let me know if you find any other issues. I've sent the patch to wine-patches/Alexandre.
Thanks for making those changes to the README, hopefully they'll get committed soon so other can avoid the problems I had.
np :-)
Jon (See attached file: winedump_fix.diff)
Hi Steve,
I added my stubbed dll to the my_other_dll_DLLS section of the Makefile.in, just like it were a normal wine dll. Is that all I need to do to link to it?
That should be all you need.
It doesn't list any of the exported functions that are listed in the spec file that winedump generated. Does wine automagically match up those stub statements with the exported symbols?
The linker magic done by winebuild is best understood by reading the .tmp.c and .spec.c from your dll. But in a nutshell the run time linking is performed by Wine, not ld. IIRC, Winebuild resolves calls to functions it locates in external dlls by building a stub call in your .exe that contains just a jump through the imports table (which is patched by the loader when your program is loaded).
Does it matter that the dll is exporting C++ classes, not straight C functions?
That could make things slightly more complicated, since MS and gcc use different name mangling systems. if you declare functions with extern "C" linkage you should be OK. However there are differences in how gcc and MS call methods on objects (and in the vtable layout etc), so in general its not advised to mix win32 c++ dlls with a winelib exe and vice versa (i.e you should implement mydll.dll as a real wine dll rather than as just a stub for linking).
<ot> I havent tried this myself, but I had thought previously about improving the gcc<->ms c++ compatability. I think what is required in the DLL case is to implement the c++ code using gcc, and then create additional exports with the names mangled using the MS convention and mapping the arguments appropraitely. </ot>
Cheers, Jon