I read some documents which gives simple examples on functions compatible with C.
__declspec(dllexport) MyFunction();
I'm okey with that. I write a small application uses the functions of this dll. I used explicit linking with
LoadLibrary()
function. C style functions work without problems. But when i write my class as
namespace DllTest
{
class Test
{
public:
__declspec(dllexport) Test();
__declspec(dllexport) void Function( int );
__declspec(dllexport) int getBar(void);
private:
int bar;
};
}
#endif
it compiles well and Dll is created. While working with C style functions i was simply taking a function pointer from LoadLibrary() and GetProcAddress(...) functions.
My previous usage is
typedef void (*Function)(int);
int main()
{
Function _Function;
HINSTANCE hInstLibrary = LoadLibrary(TEXT("test.dll"));
if (hInstLibrary)
{
_Function = (Function)GetProcAddress(hInstLibrary,"Function");
if (_Function)
{
// use the function
But now i have no idea how can i instantiate my class? How can i use explicit linkage or implicit linkage?
Any help with a code sample would be appreciated.