I have a visual c++
project in my work space which is totally depend on .lib
(static library). Now i want to create a dll
project using the existing code in visual c++ but it shows me following linking
error:
Linking...
msvcrt.lib(MSVCRT.dll) : error LNK2005: "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ) already defined in LIBCMTD.lib(stdexcpt.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: "public: __thiscall exception::exception(char const * const &)" (??0exception@@QAE@ABQBD@Z) already defined in LIBCMTD.lib(stdexcpt.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgheap.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgheap.obj)
LINK : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/finaliTest.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
I am newbie in this visual C++
. How should i procced?
code for
DllMain
:#include "stdafx.h" #include "IDT_DUKPT.h" unsigned char stringKSN[10]; unsigned char m_nderivation_key[16]; unsigned char m_ninitial_key[16]; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } void OnDecryption(){ GetKey(stringKSN, m_nderivation_key, m_ninitial_key); // Initialization of the method are written in `.lib` file. }
Where as the IDT_DUKPT.H
is:
//IDT_DUKPT.h
#define _IDT_DUKPT_H_
// TDES Encryption
void TDES_Encryption(BYTE *Data, BYTE *Key, BYTE *InitalVector, int Length);
// TDES Decryption
void TDES(BYTE *Data, BYTE *Key, BYTE *InitalVector, int Length);
// Get the Initial Key
void GetKey(BYTE *KSN, BYTE *BDK, BYTE *InitialKey);
I also put the IDT_DUKPT.lib
in my project folder and add the .lib
link to the project setting.
My main aim is to create a dll
, So that i can use the methods from my java
code using JNA
.
`