A question about call dll in c#

  • Thread starter Thread starter Beareye
  • Start date Start date
B

Beareye

there is a function in UA2011.dll :

void stdcall read_201(HANDLE h201, short *addat, unsigned long leng)


Now I write this code in c# like this:


Class Uac:
[DllImport ("UA200.DLL") ]
public static extern void read_201(int h201, IntPtr addat,long
leng);


I use read_201 to collect data,and then put into addat array:


IntPtr addat;
int result=Uac.OpenUA201(); // open handle
Uac.Start(result,0,8,2000,0); //init
Uac.read_201(result,addat,32);


but I got an error that I use a parameter not evaluated. I am not sure
how to use IntPtr addat,
who can tell me?thank you
 
[DllImport ("UA200.DLL") ]
public static extern void read_201(int h201, IntPtr addat,long
leng);


The last parameter shoud be of type int in C#.

Can't you make the addat parameter a ref short or short[] depending on
how it's used?



Mattias
 
Back
Top