mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mingw-cross-env-list] 回复: VS can't use the static library compile


From: Zach Thibeau
Subject: Re: [Mingw-cross-env-list] 回复: VS can't use the static library compiled with MinGW under Debian
Date: Thu, 17 Nov 2011 00:31:20 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0

oh mingw can support it well enough, but building a static library in mingw and then trying to use it within visual studio won't work since it uses different compiling procedures, now say if you have a dll and you managed to get an definitions export on it (.def) you could use
lib /machine:x86 (or x68 if it's from a 64bit dll) /def:testdll.def 

and you can use that generated lib that way but static libraries compiled from mingw just in general does not play nice with other compilers.

On 11/16/2011 8:54 PM, 靖飞 胡 wrote:
Hi, Volker,
Thanks for your reply. First, I must say sorry for posting questions on wrong mail list. I will move this question to your recommended mail list, i.e. MinGW-User. Second, it seems that MinGW doesn't support DLL related staff very well. And my final goal is to build a static library for my customer. Anyway, thanks.

Cheers,

Hu Jingfei


发件人: Volker Grabsch <address@hidden>
收件人: address@hidden
发送日期: 2011年11月16日, 星期三, 下午 4:35
主题: Re: [Mingw-cross-env-list] VS can't use the static library compiled with MinGW under Debian

靖飞 胡 schrieb:
> But now I converted the project into a static library,
> say mylib.a, but in visual studio I can't use the mylib.a:
> When I write a simple test function invoking the functions
> of the static library(mylib.a), the unresolved external
> symbol error occurred during linking stage. Anyone know
> how to make VS could use the static library compiled with
> MinGW? Any ideas will be appreciated. 

Static linking is compiler specific. You can't expect this
to work across different compilers (MinGW vs. VS). Usually,
you can't even expect this to work with multiple versions
of the same compiler, although you could have some luck here.

However, why do you want to do that?

If you want to distribute binaries for your library, you
should probably use dynamic linking (DLL files) instead of
static linking. If your final goal is an application (not a
library), then simply build everything with the same compiler.

Also note that this mailing list is mostly about cross
compiling. Basic questions about static vs. dynamic linking
have better chances for good answers on the MinGW-Users
mailing list.


Greets,
Volker

--
Volker Grabsch
---<<(())>>---





reply via email to

[Prev in Thread] Current Thread [Next in Thread]