WineLib and DLLs (Winedump)

Jon jon_p_griffiths at yahoo.com
Sat Sep 21 21:53:16 CDT 2002


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





More information about the wine-devel mailing list