hi,
i am not really that good at c++.
i have created an application which dynamically loads dll's as types of 'plugin'
the problem i am trying to overcome is linking back to code in the application from the dll.
i am currently within the scope of a function of the dll. i have passed a void * parameter to the dll's function and then typecast that void * to a pointer of a class; a class which i have declared in a header file and included in the dll's code for reference.
note: this may seem like an over-complicated way of achieving something, but the method has been implemented to conform with skeletal frameworks to generalise all plugins.
typecasting the pointer is not a problem, and i can access variables within the class and read/write from/to them. the problem is with calling functions of the class from the dll.
i will try to illustrate this;
application class.h
class CExample
{
public:
int variable;
void function();
}
application class.cpp
void CExample::function()
{
return;
}
dll function.cpp
#include class.h
void CDll::other_function(void *pointer)
{
CExample *classPointer = (CExample *)pointer;
classPointer->variable = 0; // this is ok
classPointer->function(); // this won't link!
}
i am using visual studio 2008, which gives the linker error LNK2019 - unresolved external symbol "public: void __thiscall CExample::function(void)"
i have read somewhere that this means the linker has no concept of the implementation of the class. the class is declared in the application and i have no static library (.lib) to import into the dll.
the basic conceptual question i need help with is this; how can i execute the function in the application, when calling from the dll?
any help would be really appreciated with this,
thanks all