Using a Visual Basic developed ActiveX dll in Borland C++ Builder 6.0
Posted on 2004-11-03
I have developed an ActiveX dll in Visual Basic and I can use this dll inside Visual Basic by just adding the dll using
Project>References then select the dll file.
That way I was able to call the dll using
Dim a as new MyClassInVB
the code in VB has a function declaration of
public function GetInt() as integer
and this works well in VB
However, I need to use this dll inside Borland C++ Builder 6.0
So I used this method
typedef int (WINAPI* typeGetInt) (void);
int a = 0;
HINSTANCE hSTM = LoadLibrary("myclassdll.dll");
if (hSTM != NULL)
GetInt = (typeGetInt) GetProcAddress(hSTM,"GetInt");
a = GetInt();
However when it runs to a=GetInt();
Project MyApp.exe raised exception class EAccessViolation with message 'Access violation at address 00000000. read of address 00000000'. Process stopped. Use Step or Run to continue.
There must be a way to use active X dlls in Borland C++ but I don't know how.
The above method works well for the dlls I've developed in Visual C++ 6.0.
Thanks in advance!