02-16-2010 12:26 AM - edited 02-16-2010 12:28 AM
the vc code follows:
#include "extcode.h"
/* LabVIEW created typedef */
typedef struct {
int32 dimSize;
double elt[1];
} TD1;
typedef TD1 **TD1Hdl;
extern "C"
{
_declspec(dllexport) void CINRun(TD1Hdl input,double *output);
};
_declspec(dllexport) void CINRun(TD1Hdl input,double *output)
{
//cannot get the first element of the array passed from labview to DLL
*output=(*input)->elt[0];
//if change the code above with follows
//*output=(*input)->dimSize;
//then it is successful to get the size of one dimension array.
//So,what's the matter?
}
the vc project and labview program are attached.
the problem is:run the labview program, cannot get the right result from the array
thanks
chen
Solved! Go to Solution.
02-16-2010 04:23 AM
You have made two errors:
Error 1 (alignment!):
Error 2: passing parameters:
Change it as shown above and it should be OK.
Andrey.
02-16-2010 06:19 AM
thank Andrey Dmitriev
you help me out of a big problem.
So, how do you know the errors?
Now I just have only one manul about DLL attached and I haven't found anything about you said above in this manul.
02-16-2010 06:28 AM
chenyin wrote:thank Andrey Dmitriev
you help me out of a big problem.
So, how do you know the errors?
Now I just have only one manual about DLL attached and I haven't found anything about you said above in this manual.
The answer is: "Experience + RTFM"
Please read the following topic: Re: Array of doubles filled by DLL contains weird values
Andrey.
02-16-2010 06:58 AM
thank you Andrey Dmitriev
thanks!It's very useful!