First, let me ask for your patience, as I am not
a C programmer, and my assistant C programmer is
not a LabVIEW programmer. I will try to be as
thorough as I can in my explanation. (By the way,
I know "alamda" is spelled wrong, but it's is
consistently wrong 🙂
I am calling a C function in a DLL. I have read
the application notes, and looked through recent
newsgroup posting, but have not seen this problem
addressed.
I am calling the C function "pidc" whose
declaration is shown below:
void DllExport pidc(float Vr,float *x,float
*y,float *z, float *sig,int ndata,float *a,int
ma,int *lista,int mfit,float **covar,float
**alpha,float *chisq,float *alamda)
{
*alamda += 2.0;
*chisq += 10.0;
x[1] = 1
.0
x[2] = 2.0
alpha[1][1] = 1000;
alpha[1][2] = 2000;
covar[1][1] =1000.0;
covar[2][2] = 2000.0;
return;
}
I am able to manipulate and pass back data in the
1D arrays (x,y,z,sig,a,lista), and numerics
(chisq, alamda), but when I manipulate data in
the 2D arrays (as shown above), LabVIEW crashes
(on the PC with the compiler, I get debugger
errors about failing to write to a memory
address).
The DLL is compiled with MS Visual C++ v6, and
I'm using LabVIEW 5.0.1 on Win98
The arrays are 0 filled to 3 X 3 dimensions prior
to calling the DLL.
I've tried passing the arrays by Array Data
Pointer, and by Array Handle (2 dimensions) but I
get memory errors either way. I've set the
calling convention to C.
In my limited capacity, I'm guessing that the
correct pointer is not getting to the C function,
and it's trying to write to some part of memory
that is a no-no.
Any suggestion?
Thanks,
-- Matt Dennie
Sent via Deja.com http://www.deja.com/
Before y
ou buy.