Hello Zhou,

2009/3/18 zhou drangon <drangon.z...@gmail.com>:
> 2009/1/13 NightStrike <nightstr...@gmail.com>:
>> On Thu, Oct 23, 2008 at 9:17 AM, Kai Tietz <kai.ti...@onevision.com> wrote:
>>> Jesper Quorning <jquorn...@clcbio.com> 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
>> Mingw-w64-public@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>
>
>
>
> --
> regards,
>
> drangon
> -------------------------
> homepage : http://www.drangon.org/
> mingw stuff : http://www.drangon.org/mingw/
> -------------------------
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

Yes, there are some issues in binutils, gcc, and our crt about this.
We plan to fix this while 4.5 Stage 1.

See 
http://sourceforge.net/tracker2/?func=detail&aid=2688335&group_id=202880&atid=983354

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to