Excel and BCB Dll Example
Posted on 2003-11-29
I need a working trivial example of a DLL written in Borland C++ Builder having a simple function and an excel spreadsheet VBA declaration that will enable me to call the function.
I have tried but with no success so far. Excel always says that it cannot find the dll.
my code for excel and bcb dll is as follows :-
Private Declare Function changeValue Lib "mydll" (x As Integer) As Integer
Private Sub CommandButton1_Click()
Dim k As Integer
k = 3
Sheet1.Cells.Range("A1").Value = changeValue(k)
Borland C++ Builder DLL source:-
extern "C" __declspec(dllexport) int __stdcall changeValue(short int y);
int __stdcall changeValue(short int y)
return y + x++;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved)
x = 7;