Hello,
Beta 2016 update 2 has a problem with VS 2015 new run-time libraries. Consider the following code (should be compiled and linked as Win32/64 Dll):
#include <Windows.h> #include <stdio.h> #include <stdlib.h> #include <mathimf.h> #pragma comment( lib, "libmmds" ) // Uncomment this to remove some errors // #pragma comment( lib, "legacy_stdio_definitions" ) BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch( ul_reason_for_call ) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } __declspec(dllexport) void CalculateSomeStuff( double x, double& Val ) { Val = pow( x, 2.3 ); }
If the target is 32 bit, then the linkage stage will give the errors:
ipo: : warning #11021: unresolved __snprintf
1> Referenced in libmmds.lib(libm_error.obj)
1>ipo: : warning #11021: unresolved __vsnprintf
1> Referenced in MSVCRT.lib(vsnprintf.obj)
1>ipo: : error #11023: Not all components required for linking are present on command line
If legacy_stdio_definitions is included, 32bit target will build successfully.
If the target is 64 bit, then the linkage step will give the errors:
1> Win32Project1.cpp
1>ipo: : warning #11021: unresolved __imp__snprintf
1> Referenced in libmmds.lib(libm_error.obj)
1>ipo: : warning #11021: unresolved __imp___iob_func
1> Referenced in libmmds.lib(libm_error.obj)
1>ipo: : warning #11021: unresolved __imp__vsnprintf
1> Referenced in MSVCRT.lib(vsnprintf.obj)
1>ipo: : error #11023: Not all components required for linking are present on command line
1> Creating library c:\vs_test\ConsoleApplication1\x64\Release\Win32Project1.lib and object c:\vs_test\ConsoleApplication1\x64\Release\Win32Project1.exp
1>libmmds.lib(libm_error.obj) : error LNK2019: unresolved external symbol __imp__snprintf referenced in function write_message
1>libmmds.lib(libm_error.obj) : error LNK2019: unresolved external symbol __imp_vsnprintf referenced in function write_message
1>MSVCRT.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp_vsnprintf
1>libmmds.lib(libm_error.obj) : error LNK2019: unresolved external symbol __imp___iob_func referenced in function write_message
1>MSVCRT.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp__vsnprintf
1>c:\vs_test\ConsoleApplication1\x64\Release\Win32Project1.dll : fatal error LNK1120: 4 unresolved externals
Including legacy_stdio_definitions will not fix the problem completely:
1>ipo: : warning #11021: unresolved __imp___iob_func
1> Referenced in libmmds.lib(libm_error.obj)
1>ipo: : error #11023: Not all components required for linking are present on command line
1> Creating library c:\vs_test\ConsoleApplication1\x64\Release\Win32Project1.lib and object c:\vs_test\ConsoleApplication1\x64\Release\Win32Project1.exp
1>libmmds.lib(libm_error.obj) : error LNK2019: unresolved external symbol __imp___iob_func referenced in function write_message
I believe the version of libmmds.lib should be somehow adjusted to new VS2015 run-time.
Regards,
Michael