http://blog.csdn.net/songbohr/article/details/5276128
前几天做一个模拟器时要把sdk代码在从linux移植到windows,我当初选用方案使用cygwin,然而却碰到一个crash的问题而搁浅。于是上周发了一个email到cygwin 的maillist,没想到得到cygwin官方的回复,原来faq里早就有了。另外我补充了几点注意的地方,faq还是说的不严谨。
Re: gcc and vc compiled library problem
On 01/28/2010 08:14 PM, phil song wrote:
> Hi,cygwin!
> pls forgive my poor english at first.
>
> I have compiled one sdk_lib dll using gcc in cygwin,and I writed a tool
> convert the dll to .lib so I can call the interface function in sdk_lib
> dll using vc. Then I wrote a application using VC2005,when it ran at
> beginning,everything looks like ok,but when I call a function
> "tti_readfile" which call "open write close" in sdk_lib many times,The
> application exited.By debuging,I find the it crashed in function
> "_aclcheck" in "cygwin1.dll". But I found the file had been write
> success,however,after the app called it,it crashed.
>
> who can tell me what cause this?How to resolve it?Can the dll(compiled by
> gcc) and app(compiled by vc) run in the same process?
<http://cygwin.com/faq/faq-nochunks.html#faq.programming.msvcrt-and-cygwin>
<http://cygwin.com/faq/faq-nochunks.html#faq.programming.msvs-mingw>
--
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
216 Dalton Rd. (508) 893-9889 - FAX
Holliston, MA 01746
_____________________________________________________________________
A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
下面是我的详细步骤,测试成功,GCC+VC可以完全兼容了
How do I use | |
If you want to load the DLL dynamically, read
If you want to link statically from Visual Studio, to my knowledge none of the Cygwin developers have done this, but we have this report from the mailing list that it can be done this way:
另外 1.把int main(int argc,char *argv[])改为int main(int argc,char *argv[], char **env) 2.设置VC的入口点为mainCRTStartup |