From: SourceForge.net <no...@so...> - 2003-04-30 02:43:05
|
Bugs item #729213, was opened at 2003-04-29 06:14 Message generated for change (Comment added) made by infidel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=729213&group_id=2435 Category: gcc Group: None Status: Deleted Resolution: Invalid Priority: 5 Submitted By: Federico Andres Lois (flois) >Assigned to: Luke Dunstan (infidel) Summary: Windows DLL linking problem Initial Comment: Hi, i had been trying to link a VC6.0 ready made library for RPC with DLL. So i had made the import libraries using the dllwrap tool provided with Dev-Cpp. I am using the last Beta version of Dev- Cpp which package the Mingw 3.2 compiler, i had tracked down the problem to the linker. I put this as a bug report because the linker generate a windows error message when trying to link this project. I had tried linking with the --allow-multiple-definition directive but cannot link the project either. Take a look at the attach, it is the complete project so you can trigger the error. My specs are: Windows XP Professional 256 MB Memory Dev-Cpp Beta 4.9.8.0 --------------------- Cut here ------------------------- Configured with C:\ARCHIV~2\MISDOC~1\RPCGcc\Configured with ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as -- host=mingw32 --target=mingw32 --prefix=/mingw --enable- threads --disable-nls --enable-languages=f77,c++,objc,ada -- disable-win32-registry --disable-shared Thread model C:\ARCHIV~2\MISDOC~1\RPCGcc\Thread model win32 crtstuff.c C:\Archivos de Datos\Mis Documentos\RPCGcc\d32- rpc.lib(.text+0x110) multiple definition of `atexit' crt1.c C:\Program Files\Dev-Cpp\lib\crt2.o(.text+0x40) first defined here crtstuff.c C:\Archivos de Datos\Mis Documentos\RPCGcc\d32- rpc.lib(.text+0x140) multiple definition of `_onexit' crt1.c C:\Program Files\Dev-Cpp\lib\crt2.o(.text+0x60) first defined here . . . crtstuff.c C:\Archivos de Datos\Mis Documentos\RPCGcc\d32- rpc.lib(.rdata+0x0) multiple definition of `__EH_FRAME_BEGIN__' crtstuff.c C:\Program Files\Dev-Cpp\lib\gcc-lib\mingw32\3.2 \crtbegin.o(.eh_frame+0x0) first defined here C:\ARCHIV~2\MISDOC~1\RPCGcc\Makefile.win [Build Error] [RPCCLI~1.exe] Error 1 -------------------------------------------------------- Greetings Federico Andres Lois Xenocide Programming Team ---------------------------------------------------------------------- >Comment By: Luke Dunstan (infidel) Date: 2003-04-30 10:43 Message: Logged In: YES user_id=30442 When you say this is a "VC 6.0 ready-made library", was it supplied with an import library d32-rpc.lib? If so, the first thing you should try is using that import library with MinGW, because there is no easy automatic way to generate one for this DLL. The problem is that the functions use the stdcall convention so the MinGW linker is looking for symbols like "clnt_create@16", but the DLL itself only exports "clnt_create". One way to get around this manually is to modify the line in your .def file to "clnt_create@16", then generate the import library with: dlltool --input-def d32-rpc.def --output-lib d32-rpc.lib --dllname d32-rpc.dll --kill-at Then remove the unnecessary linker flags and the linker will stop complaining about this symbol. As I said though, it would be preferable to use the original MSVC import library because otherwise you will have to modify each line in the .def file that the linker complains about. ---------------------------------------------------------------------- Comment By: Federico Andres Lois (flois) Date: 2003-04-29 23:25 Message: Logged In: YES user_id=127707 Hi, In fact that makefile is from like 6 hours of tweaking and trying different flags for the linker, compiler and everything... the only one i was thinking could work was --allow-multiple-definition cause in the error message sais it has multiple definitions... I used to work with both VC and Borland compilers and use a pretty similar process to create an import library from the DLL, i had switched to GCC like a week ago for a new project i am working on, so i am a complete newbie... I had reported as a bug report because of the Windows Error, not because i couldnt make it work (even though i need help on that too if you can provide it). I had tried with both dllwrap and dlltool, with no success. The procedure i have to do is (at least in the other compilers), is it the same for GCC? Given the DLL, i create the import library for the DLL. Use that import library in the linker... and run the program... Can you explain me how or should i post this in the forums? Thanks in advance Greetings Federico Andres Lois Xenocide Programming Team ---------------------------------------------------------------------- Comment By: Luke Dunstan (infidel) Date: 2003-04-29 10:44 Message: Logged In: YES user_id=30442 Your d32-rpc.lib is a DLL, not an import library, because you used dllwrap to generate it instead of dlltool. The flags "--allow- multiple-definition" and especially "--allow-shlib-undefined" in your makefile are almost certainly incorrect too. And why are you using -nostdlib? Sorry, but it just looks like random flags have been added without knowing what they do :-) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=729213&group_id=2435 |