Yes, that works. Thanks, Chip.
Now, moving closer to what I really need to do, I need to add an
array argument to the callback function:
long __stdcall tryCB3(long n,long(__stdcall *cbFunc)(long m, long *))
{
....
long* x= new long[n];
....
r = cbFunc(n, x);
...
delete [] x;
return r;
}
And in the
VB:
Public Function theCBFunc4(ByVal m As Long, ByRef x() As Long) As Long
Dim i As Integer
Dim s As Long
s = 0
For i = 0 To m - 1
s = s + x(i)
Next i
theCBFunc4 = s
End Function
But, it doesn't work. It crashes Excel when I call the tryCB3 function from
VB.
Any ideas?
TIA
Ed