|Applies To||RSA BSAFE SSL-C|
|Issue||How to resolve library conflicts in RSA BSAFE SSL-C (e.g. link errors such as LNK4098 and LNK2005)|
msvcrt.lib(MSVCRT.dll) : error LNK2005: _strncmp already defined in LIBCD.lib(strncmp.obj)
LINK : warning LNK4098: defaultlib "library" conflicts with use of other libs
|Cause||These and similar errors are caused by linking the application with different standard C run-time libraries than those used by the RSA BSAFE libraries.|
|Resolution||The Visual C++ compiler option /ML, /MT or /MD linked with the application needs to match the option used to build the RSA BSAFE libraries|
The Visual C++ Compiler Options /ML, /MT and /MD determine the source and nature of the standard C run-time libraries linked with the application
/ML causes the compiler to link with LIBC.lib, which does not provide multithreaded support
/MT causes the compiler to link with LIBCMT.lib, which provides multithreaded support
/MD causes the compiler to link with MSVCRT.lib, which dynamically links with MSVCR71.DLL and provides multithreaded support
According to Microsoft: "Do not mix static and dynamic versions of the run-time libraries. Having more than one copy of the run-time libraries in a process can cause problems, because static data in one copy is not shared with the other copy. The linker prevents you from linking with both static and dynamic versions within one .exe file, but you can still end up with two (or more) copies of the runtime libraries. For example, a dynamic-link library linked with the static (non-DLL) versions of the run-time libraries can cause problems when used with an .exe file that was linked with the dynamic (DLL) version of the run-time libraries. NOTE: You should also avoid mixing the debug and non-debug versions of the libraries in one process.
NOTE: SSL-C releases are generally built with /MD, although there have been some custom builds that used /ML or /MT. Custom builds created with /ML or /MT will be clearly marked as such.
|Legacy Article ID||a26610|