I'm creating a C++ MFC dll using Visual Studio 2005.
I can call "CALCCMR" successfully from a dll, but not "CALCCLOGP". Here's the code that calls the dll:
In my main function, I follow the directions provided with the 3rd party dll:
The instructions show how to call these function, but leave out/not explain some of the variables being passed. For example, there is no reference to a variable named Smiles. However, this is the value being passed to the dll, so if I hard-code it, it works when I try calcCMR(Smiles, &pCMR):
I run this and it compiles fine.
Here's the example for calculating calcLogp:
When I compile this, I get the following errors:
There is no other additional information about the type for these variables, and I'm new to C++ so don't know what I'm missing.
I've tried declaring these variables according to what's being imported, but still get errors. Does anyone have any insight?
I can call "CALCCMR" successfully from a dll, but not "CALCCLOGP". Here's the code that calls the dll:
Code:
// import DLL functions
typedef long (CALCLOGP)(const char*, float*, long*, HANDLE*);
typedef long (CALCCMR)(const char*, float*);
typedef long (CALCXMR)(const char*, float*);
typedef long (CALCMGVOL)(const char*, float*);
typedef long (MOL_FILE_IMPORT) (char* inputF, char* outputF);
typedef double (CLOGP_VIA_MOL) (char* myMol);
static CALCLOGP* calcLogP = NULL;
static CALCCMR* calcCMR = NULL;
static CALCXMR* calcXMR = NULL;
static CALCMGVOL* calcMgVol = NULL;
static MOL_FILE_IMPORT* mol_file_import;
static CLOGP_VIA_MOL* clogp_via_mol;
static HINSTANCE hinstCLogP = NULL;
static HINSTANCE hinstCopy = NULL;
In my main function, I follow the directions provided with the 3rd party dll:
Code:
//Complete the import of the dll routines
hinstCLogP = LoadLibrary("bb-clogp.dll");
hinstCopy = hinstCopy;
calcLogP = (CALCLOGP *) GetProcAddress(hinstCLogP, "calcLogP");
calcCMR = (CALCCMR *) GetProcAddress(hinstCLogP, "calcCMR");
calcXMR = (CALCXMR *) GetProcAddress(hinstCLogP, "calcXMR");
calcMgVol = (CALCMGVOL *) GetProcAddress(hinstCLogP, "calcMgVol");
mol_file_import = (MOL_FILE_IMPORT *) GetProcAddress(hinstCLogP, "mol_file_import");
clogp_via_mol = (CLOGP_VIA_MOL *) GetProcAddress(hinstCLogP, "clogp_via_mol");
The instructions show how to call these function, but leave out/not explain some of the variables being passed. For example, there is no reference to a variable named Smiles. However, this is the value being passed to the dll, so if I hard-code it, it works when I try calcCMR(Smiles, &pCMR):
Code:
long err;
float pCMR;
err = calcCMR("O=C", &pCMR);
I run this and it compiles fine.
Here's the example for calculating calcLogp:
Code:
float pLogP;
long err;
long pNumContrb;
// Note: These MUST be GlobalFree( ) 'd after calls to calcLogP
LogPContribution** pClogPContrb, * pclogp;
pLogP = -99.99f;
pNumContrb = 0;
err = calcLogP(smiles, &pLogP, &pNumContrb, &pClogPContrb);
// smiles holds the smiles string of course.
// pLogP will have your value if err is less than 60.
// Later you must free as follows...
// GlobalFree(pClogPContrb);
// GlobalFree(pclogp);
When I compile this, I get the following errors:
Code:
c:\documents and settings\epajn\my documents\visual studio 2005\projects\cfx_clogp\request.cpp(62) : error C2065: 'LogPContribution' : undeclared identifier
c:\documents and settings\epajn\my documents\visual studio 2005\projects\cfx_clogp\request.cpp(62) : error C2065: 'pClogPContrb' : undeclared identifier
c:\documents and settings\epajn\my documents\visual studio 2005\projects\cfx_clogp\request.cpp(62) : error C2065: 'pclogp' : undeclared identifier
There is no other additional information about the type for these variables, and I'm new to C++ so don't know what I'm missing.
I've tried declaring these variables according to what's being imported, but still get errors. Does anyone have any insight?