From: zhou d. <dra...@gm...> - 2009-03-18 07:03:23
|
2009/1/13 NightStrike <nig...@gm...>: > On Thu, Oct 23, 2008 at 9:17 AM, Kai Tietz <Kai...@on...> wrote: >> Jesper Quorning <jqu...@cl...> wrote on 23.10.2008 14:13:08: >> >>> Hi All, >>> I try to link together a module compiled with x86_64-pc-mingw32-gcc and >>> a module compiled with MS cl (64bit). link with MS link, but it fails >> with >>> >>> hello.obj : error LNK2019: unresolved external symbol call_me referenced >> >>> in function main >>> >>> I have tryed with different call conventions but without any luck. What >>> am I missing here ? >>> >>> Regards, >>> Jesper Quorning >> >> The problem here is the name decoration. MS doesn't extend the public >> symbols in objects by underscores, mingw-w64 does this by default. But you >> can recompile mingw-w64 crt and your app by using option >> -fno-leading-underscores. This should work. >> The other solution would be, name the exported method call_me in VS >> _call_me, and reference in gcc just without the leading underscore. >> >> I hope I could help. >> >> Cheers, Kai I have the similar problem and the -fno-leading-underscores resolve the problem. Now I can use VS2005 to link with static library created by mingw-w64. But when I want to change the static library to dynamic library, the following error emit : g++ -g -Wall -pipe -fno-leading-underscore -DDLL_CREATE -c -o adlib.o adlib.cpp g++ -g -Wall -pipe -fno-leading-underscore -DDLL_CREATE -shared -Wl,--out-impli b,adlib.lib -o adlib.so adlib.o Creating library file: adlib.lib Cannot export _ZN4ADYC4FuncEi: symbol not found Cannot export _ZN4ADYCC1Ev: symbol not found Cannot export _ZN4ADYCC2Ev: symbol not found Cannot export _ZN4ADYCD1Ev: symbol not found Cannot export _ZN4ADYCD2Ev: symbol not found Cannot export g_dy_data: symbol not found Cannot export g_dy_func: symbol not found collect2: ld returned 1 exit status make: *** [adlib.so] Error 1 Even If I do not create the import-library for VS2005, the error emit : g++ -g -Wall -pipe -fno-leading-underscore -DDLL_CREATE -c -o adlib.o adlib.cpp g++ -g -Wall -pipe -fno-leading-underscore -DDLL_CREATE -shared -o adlib.so adl ib.o Cannot export _ZN4ADYC4FuncEi: symbol not found Cannot export _ZN4ADYCC1Ev: symbol not found Cannot export _ZN4ADYCC2Ev: symbol not found Cannot export _ZN4ADYCD1Ev: symbol not found Cannot export _ZN4ADYCD2Ev: symbol not found Cannot export g_dy_data: symbol not found Cannot export g_dy_func: symbol not found collect2: ld returned 1 exit status make: *** [adlib.so] Error 1 The gcc version I used is : E:\code\test_inter>gcc -v Using built-in specs. Target: x86_64-pc-mingw32 Configured with: ../gcc/configure --host=x86_64-pc-mingw32 --target=x86_64-pc-mi ngw32 --disable-nls --enable-languages=c,c++ --with-gmp=/compile/mingw/for_targe t --enable-twoprocess --disable-libstdcxx-pch --prefix=/compile/mingw/target --w ith-sysroot=/compile/mingw/target Thread model: win32 gcc version 4.4.0 20090307 (experimental) (GCC) > > Jesper, did this fix your issue? > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Mingw-w64-public mailing list > Min...@li... > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > -- regards, drangon ------------------------- homepage : http://www.drangon.org/ mingw stuff : http://www.drangon.org/mingw/ ------------------------- |