Call to undefined function 'Encrypt' - Attempting to Link OMF Lib
Posted
by Changeling
on Stack Overflow
See other posts from Stack Overflow
or by Changeling
Published on 2010-04-02T19:30:07Z
Indexed on
2010/04/02
19:33 UTC
Read the original article
Hit count: 343
I created a DLL using Visual Studio 2005 VC++ and marked a function for export (for testing).
I then took the .LIB file created, and ran it through the COFF2OMF converter program bundled with Borland C++ Builder 5 and it returns the following:
C:\>coff2omf -v -lib:ms MACEncryption.lib MACEncryption2.lib
COFF to OMF Converter Version 1.0.0.74 Copyright (c) 1999, 2000 Inprise Corporat
ion
Internal name Imported name
------------- -------------
??0CMACEncryptionApp@@QAE@XZ
?Decrypt@CMACEncryptionApp@@QAEXXZ
Encrypt Encrypt@0
I added the MACEncryption2.lib file to my C++ Builder 5 Project by going to Project->Add to Project.. and selecting the library.
The application links, but it cannot find the Encrypt function that I am declaring for export as follows in the VC++ code:
extern "C" __declspec(dllexport) BSTR* __stdcall Encrypt()
{
CoInitialize(NULL);
EncryptionManager::_EncryptionManagerPtr pDotNetCOMPtr;
HRESULT hRes = pDotNetCOMPtr.CreateInstance(EncryptionManager::CLSID_EncryptionManager);
if (hRes == S_OK)
{
BSTR* str = new BSTR;
BSTR filePath = (BSTR)"C:\\ICVER001.REQ";
BSTR encrypt = (BSTR)"\"test";
pDotNetCOMPtr->EncryptThirdPartyMessage(filePath, encrypt, str);
return str;
}
return NULL;
CoUninitialize ();
}
C++ Builder Code:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Encrypt();
}
(Yes I know I am encapsulating another DLL.. I am doing this for a reason since Borland can't 'see' the .NET DLL definitions)
Can anyone tell me what I am doing wrong so I can figure out why Builder cannot find the function Encrypt() ?
© Stack Overflow or respective owner