C
Charles Wang
Hello Everyone!
I want to get data from a A/D card.
All functions that control this A/D card are included in ADCard.dll, native
code;
I import functions using DllImport. Other functions, such as Initial() and
StarIntr() etc, work fine except ADResult();
ADResult() is defined as int __stdcall ADResult(ADCard_Result * Buf).
ADCard_Result is a struct:
typedef unsigned short ADValueType;
typedef struct structADResult {
ADValueType SeqNo;
ADValueType ADValue[1];
} ADCard_Result;
I import this function like this:
public struct ADCard_Result
{
ushort SeqNo;
ushort ADValue;
}
[DllImport("ADCARD.DLL", EntryPoint="ADResult", SetLastError=true)]
private extern static int ADResult(ADCard_Result[] Buf);
In main progress I call this function like this:
ADCard_Result[] pResult = new ADCard_Result[10000];
pResult.Initialize();
int r = ADCard(pResult);
But all the pResult[0-10000] is 0. I alse use out and ref but they take no
effect.
Any suggestion is welcome! Thanks!
I want to get data from a A/D card.
All functions that control this A/D card are included in ADCard.dll, native
code;
I import functions using DllImport. Other functions, such as Initial() and
StarIntr() etc, work fine except ADResult();
ADResult() is defined as int __stdcall ADResult(ADCard_Result * Buf).
ADCard_Result is a struct:
typedef unsigned short ADValueType;
typedef struct structADResult {
ADValueType SeqNo;
ADValueType ADValue[1];
} ADCard_Result;
I import this function like this:
public struct ADCard_Result
{
ushort SeqNo;
ushort ADValue;
}
[DllImport("ADCARD.DLL", EntryPoint="ADResult", SetLastError=true)]
private extern static int ADResult(ADCard_Result[] Buf);
In main progress I call this function like this:
ADCard_Result[] pResult = new ADCard_Result[10000];
pResult.Initialize();
int r = ADCard(pResult);
But all the pResult[0-10000] is 0. I alse use out and ref but they take no
effect.
Any suggestion is welcome! Thanks!