From: Jiri K. <jirikrivanek@BetaControl.cz> - 2003-01-29 07:01:28
|
> Hi Jiri, > > > "Jiri Krivanek" <jirikrivanek@BetaControl.cz> writes: > > When I use the above mentioned technique, I receive the following > > linker error message (please note that this is only one of many): > > ...:main.c: undefined reference to 'GdipDeletePen@4' > > So your example was incomplete in a central aspect. :-( Sorry for that, I discovered this later as I have not known anything about mangling ... > > As you have already discovered, "...@4" indicates that __stdcall is > used with the functions that you want. Note that most Windows API use > that calling convention. Sadly the internal representation of the > symbols, with the "...@4", is not the same as the one regularly used > by Windows APIs, without decoration. > > So lets try again. I add __stdcall to the prototype and definition of > Mul(). I execute > > c:\tmp> gcc -shared -Wl,--kill-at -o kkh.dll kkh.c > c:\tmp> objdump -p kkh.dll | grep Mul > [ 0] Mul > > To get a DLL that matches your requirements. > > Now I'd expect that > > c:\tmp> gcc -Wl,--enable-stdcall-fixup -o kkh-user.exe ^ > kkh-user.c kkh.dll > > should work, but sadly it doesn't. This may be a bug in the linker or > a misunderstanding of --enable-stdcall-fixup on my part. > > So I use the traditional method. Create a module definition file that > matches the DLL and from that make an import library > > >>>>>>>>> kkh.def > LIBRARY 'KKH.DLL' > EXPORTS > Mul@8 > <<<<<<<<< > > c:\tmp> dlltool --kill-at --input-def kkh.def --output-lib kkh.lib > > This links and works: > > c:\tmp> gcc -o kkh-user.exe kkh-user.c kkh.lib > c:\tmp> kkh-user > 2*2=4 > > So the process is: Create a function list for the GDI+ DLLs (use a > script based on objdump), add the right suffixes (4 * > number-of-parameters) and create an import library. And they lived > happily ever after ;-). > > > Hope this helps, benny > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > Ing. Jiri Krivanek Realtime applications programmer Beta Control s.r.o. Cerneho 58/60 635 00 BRNO-Bystrc CZECH REPUBLIC tel.: +420 5 46 22 34 91 - 36 email 1: JiriKrivanek@BetaControl.cz |