I'm trying to add a project to Visual Studio 2013 that will build OpenSSL in the Visual Studio GUI. I'm using the "makefile" project settings as a starting point.
I've already succeeded in building OpenSSL on a Visual Studio command line window, and it works. However, when I try to build OpenSSL through the project using the exact same commands that I use in the command line, I get linking errors (LNK2001).
Looking at the resulting .lib files with dumpbin, I see that when I build OpenSSL through the GUI, an underscore ('_') is appended to all the exports (So a function that's called BIO_read
will become _BIO_read
).
Microsoft has this to say about LNK2001: https://msdn.microsoft.com/en-us/library/f6xx1b1z.aspx?f=255&MSPPError=-2147217396
Specifically, it says:
When a symbol is unresolved, you can get information about the function by the following guidelines:
On x86 platforms, the calling convention decoration for names compiled in C, or for extern "C" names in C++, is:
__cdecl
Function has an underscore (_) prefix.
I think that cl is called with slightly different parameters which make it emit underscore prefixes, but I'm unable to figure out what exactly is different - the command line is not different and if there are differences in the environment variables I couldn't find a relevant one.
Any ideas what's going on here?