Is it possible to use a gcc compiled library with MSVC?

若如初见. 提交于 2019-12-03 16:27:48

Yes, this is possible because if you compile strictly as a C interface, iconv will link to msvcrt.lib, which is the Windows C runtime (strictly C, analogous to glibc used by GCC). If you built it with GCC's normal C++ compiler, it would link to libstdc++ and also name mangle differently compared to VC++, which links to msvcr.dll.

In your case, __chkstk is the check stack function (part of C runtime), a function that is injected into each function call to check for stack overflows. I am not sure how to resolve this a 'good' way, but you can change your build options for iconv to build with an additional compiler flag and suppress this check: /Gs999999


However, I have built libiconv with Visual C++ 2005/2008/2010, and software I have built on top of it worked perfectly (software used by military institutions, if you need credibility). I do remember it being slightly annoying to build using the VC++ compiler though, but it should not be too much pain.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!