How to use libraries compiled with MingW in MSVC?
来源:互联网 发布:蛀牙漱口水 知乎 编辑:程序博客网 时间:2024/06/06 11:41
http://stackoverflow.com/questions/2529770/how-to-use-libraries-compiled-with-mingw-in-msvc
http://blogs.msdn.com/b/vijay/archive/2009/10/02/what-is-name-decoration-or-name-mangling.aspx
Based on this error you put in a comment:
error LNK2019: unresolved external symbol "int __cdecl openssl_call(struct ssl_State *,int,int,int)" (?openssl_call@@YAHPAUssl_State@@HHH@Z) referenced in function _main MyAPP.obj all other 4 errors are same only with other functions names
Try putting extern "C"
around your include files for openssl. For example:
extern "C" {include "openssl.h"}
using extern "C" will instruct the compiler that the functions are using C linkage, not C++, which will stop it from performing name mangling on the functions. So it will look for the function openssl_call in the library rather than ?openssl_call@@YAHPAUssl_State@@HHH@.
http://lists-archives.com/mingw-users/05372-linking-with-windows-vssapi-dll.htmlMany years ago, I had to interface to a third-party dll forwhich I simply couldn't manage to build an import librarythat worked, despite much effort. So I fell back on what Iguess is the most elementary, brute-force technique, andwrote a '.def' file by hand--and that worked.NAME 'WHATEVER'EXETYPE WINDOWSIMPORTS _WhateverNameYouWant =GOOFY_DLL.GoofyInternalName [Snip hundreds of other functions...but you want only one]That was the magic glue that let me call an msvc-builtdll from an application built with a different proprietarycompiler. Later, I rebuilt my application with gcc, creatinga gcc import library this way:libGOOFY_DLL.a: $(some_directory)/GOOFY_DLL.dll GOOFY_DLL.def $(DLLTOOL) \ --dllname GOOFY_DLL.dll \ --input-def $(src_dir)/GOOFY_DLL.def \ --output-lib libGOOFY_DLL.a
- How to use libraries compiled with MingW in MSVC?
- Use Pseudoregisters to debug in MSVC++
- How to use libcurl in C++ with std::string
- [CakePHP]How to use Session in conjunction with Memcache
- How to use json with as3corelib in flex( JSON )
- How to use Comparator and Comparable in Java? With example
- How To Use Ip Command In Linux with Examples
- How to Use Linux Commands in Windows with Cygwin
- How to use GCC to build DLL by DEF file in MinGW?
- How to compile OpenJPEG in MinGW?
- How to compile SDL in MINGW?
- How to use isInEditMode() to see layout with custom View in the editor
- How Linkers Use Static Libraries to Resolve References
- How to use MinGW Cross Compiler on Fedora
- How To Use Linux epoll with Python
- How to use Trace2UML together with Doxygen
- How To Use Linux epoll with Python
- How to use Blocks with iOS
- JavaScript 全选,反选,全不选
- Name Mangling
- Unicode也是一种字符编码方法,容纳65536个字符
- RIM发布Gameplay跨平台开源3D引擎
- camera与opengl es的融合显示(AR基础)
- How to use libraries compiled with MingW in MSVC?
- 宽字符和Unicode并不完全等同,Unicode只是宽字符的一种编码方式
- 驱动程序涉及到的头文件
- cmd中用TAB 键,可以list 所有可能的匹配方法,python和java等都一样
- Png图片处理是不是把png图片透明
- Windows下Tinyxml的正确配置
- LaTeX新人教程,30分钟从完全陌生到基本入门
- hsqldb源码分析系列3 执行引擎分析 插入过程分析
- 设计模式之外观模式