PDA

View Full Version : Problem regarding DLL



vermarajeev
3rd October 2006, 12:07
Hi guys,
I'm in a great problem and need urgent help

I have two modules in my project 1) CMBEDIT 2) SYNTHESIS_TOOL

I have these files common between these two modules
i) ct.h
ii) ct.cpp
iii) route.h
iv) route.cpp
v) basemolecule.h
vi) basemolecule.cpp
vi) some more etc etc but the above are basic one

No I have to create dll( DYnamic Link Library ) which will act as a repository for those common files.

When I execute CMBEDIT, it should call (dll) and make use of those files, vice versa When I execute SYNTHESIS_TOOL, it should call same (dll) and make use of those files.

Now I'm able to create the Dll named (myDll) and also able to compile. It creates *.dll and *.lib files. I have included myDll into my module(CMBEDIT). Finally when I execute my module(CMBEDIT) containing myDll, I get the following run time error

"ENTRY POINT NOT DEFINED"
"The procedure entry point?otherringnbr@atompair@@SAHAAVbasemolecule@@H HH@Z could not be located in the dynamic link library myDll.dll"

Below is the class declaration for the above error which contains otherringnbr defined in it

Prototype of class

#include "../myDll.h"
class MYDLL_API basemolecule; //some other class

#define ap atompair::apinstance

class MYDLL_API atompair
{
public:

static atompair apinstance;

static int allringsthesame(basemolecule& mol,int x,int y);
static int allsaturatedcarbonsbetween(basemolecule&,int x,int y);
static int anothercommonring(basemolecule&,int ring1,int x,int y);
static int aziridineformationpossible(basemolecule& mol,int x,int y);
static int bondbalance(basemolecule& mol,rownumber x,rownumber y);
static int bettercarbanion(basemolecule&,int x,int y);
static int bettermeta(basemolecule& mol,int x,int y);
static int betternucleophile(basemolecule& mol,int x,int y/*,int re*/);
static rownumber betterortho(basemolecule& mol,rownumber middleatom,
rownumber y,rownumber enteringatom); //2001/2/26/at
static int bicyclonumber(basemolecule&,int x,int y);
static int otherringnbr(basemolecule& mol,int ringnum,int x,int y);
static int otherringnbr(basemolecule& mol,int ringnum,int x,int y,int z);
};

Any help will be highly appreciated

Thanx in advance

jacek
3rd October 2006, 17:29
How did you define MYDLL_API macro?

Trasmeister
4th October 2006, 16:26
A couple of possibilities.

1.) Is the DLL in the SAME directory as the executable you are using to open up the DLL?

If not, then you'll get a run time error similar to that because the program cannot pick up the DLL. To solve this, just copy your DLL to the same location as the program executable.

2.) (as questioned) Are you defining the imports/exports correctly?

this would be something like:



#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif


You need to set MYDLL_EXPORTS as a pre-processor definition in your DLL project, but leave it blank in the application.

vermarajeev
5th October 2006, 04:57
Hi guys,
Thanks for your interests. It was a silly mistake made by me. I had not included correct DLL in my executable directory due to which I was getting that error. I have fixed the problem and the module works fine.

Thanks