I'm have written a Visual Basic DLL, and I want to access it from my C++ code.
I've read this:
I am able to load the DLL, but I am not able to load any functions.
Think you can help? -Look below if you need to see my code.
Here is my Visual Basic code:
And this is my C++ code:
' Initializes the Class
Private Sub Class_Initialize()
MsgBox "This procedure is called when the DLL is loaded into memory.", vbOKOnly, "Initializing Class..."
MsgBox "We are testing to use DLLs created in Visual Basic to work with C++", vbOKOnly, "Test function..."
' Terminates the Class
Private Sub Class_Terminate()
MsgBox "This procedure is called when the DLL is removed from memory.", vbOKOnly, "Cleaning up..."
typedef void (WINAPI*vbfunc)();
// OPCCplusplusTest.cpp : Defines the entry point for the console application.
int main(int argc, char* argv)
HINSTANCE hLib = LoadLibrary("OPCclient.dll");
if(hLib == NULL)
printf("ERROR: Unable to load library!\n");
TestFunc = (vbfunc)GetProcAddress((HMODULE)hLib,"Class_TestFunc");
printf("Unable to load function(s).\n");