Hi Chritian,
u hav given a nice example of exporting class from dll.
if i hav to export functions from dll, i used the following code ... please chk and reply if its correct or not :
in my QGrid.h file :
//test function
QGRID_EXPORT int asum(int a,int b)
{
return a+b;
}
//test function
QGRID_EXPORT int asum(int a,int b)
{
return a+b;
}
To copy to clipboard, switch view to plain text mode
in my project eventtable.h file :
QGRID_EXPORT int asum(int a,int b);
QGRID_EXPORT int asum(int a,int b);
To copy to clipboard, switch view to plain text mode
if i don't import the function as above, the compiler generates error that
error C2065: 'asum' : undeclared identifier
error C2065: 'asum' : undeclared identifier
To copy to clipboard, switch view to plain text mode
in eventable.cpp file :
i call the function directly as a local function:
int a = asum(2,5);
int a = asum(2,5);
To copy to clipboard, switch view to plain text mode
this on compiling the main project gives the following linker warnings :
LINK
: warning LNK4049
: locally defined symbol
""public: __thiscall QGrid
::QGrid(class
QWidget *)" (??0QGrid@@QAE@PAVQWidget@@@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: virtual __thiscall QGrid::~QGrid(void)" (??1QGrid@@UAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""int __cdecl asum(int,int)" (?asum@@YAHHH@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall QGrid::QGrid(class QWidget *)" (??0QGrid@@QAE@PAVQWidget@@@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: virtual __thiscall QGrid::~QGrid(void)" (??1QGrid@@UAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""int __cdecl asum(int,int)" (?asum@@YAHHH@Z)" imported
To copy to clipboard, switch view to plain text mode
what is the reason of these warnings. the project is working fine though.
i m using VC++ compiler ...
Bookmarks