I am trying to pass a 2D array from VB5 to a Visual C++ DLL. I wanto to use pointer to ponter for passing an 2D array and pointer to function for a 1D array
In
VB iI call the dll
declare public sub foo Lib foo32.dll" (ByRef MyArray As Double, ByVal N As Long, ByRef MyVector As Double)
.
.
.
.
foo(MyArray(1, 1), Dimension, MyVector(1))
'I pass MyVector as an empty vector
c dll is:
void __stdcall foo ( double* *MyArray, int N, double *MyVector)
{
int i, l, ii, k;
double g, f;
i=N;
for( ii=2;ii<=N;ii++)
{
l=i-2;
f=MyArray[i][i-1];
g=0.0;
while(l>=1)
{
for( k=1;k<=l;k++)
{
g+=MyArray[i][k]*MyArray[i][k];
}
}
}
if(g<=0.0000001)
{
MyVector[i]=0.0;
}
.
.
.
.
}
There are no problem with the compiler and I get compiled dll with neither error nor warnings.
It seems C doesn't get the values the right way, as values in stead of an address.
When I run this program,
VB hangs up when debugging I can see that MyArray shows an memory address and doesn't any value.
have I to use static variables in dll?
are there a problem with memory allocation?
Please, anyone can help me?
Thanks advanced