Re: P/Invoke BYTE *



I think that you want that to be a byte array.

public static extern void myfunction(IntPtr myhandle, Byte byAddress,
byte[] pDataBuffer, int iSize);

Paul T.

"Mario" <alphatommy@xxxxxxxxxxx> wrote in message
news:1153946653.546113.166310@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I have this function in a dll

void myfunction (HANDLE myhandle, BYTE byAddress, BYTE* pDataBuffer,
int iSize)

Invoking using Platform invoke by using the following:

[DllImport("mydll.dll")]
public static extern void myfunction(IntPtr myhandle, Byte byAddress,
ref Byte pDataBuffer, int iSize);

Somehow I don't seem to be getting data from pDataBuffer. What is the
right declaration for BYTE * in platform invoke?

Thanks.



.



Relevant Pages

  • Re: P/Invoke BYTE *
    ... Paul G. Tobey wrote: ... value to pDataBuffer. ... bytepDataBuffer, int iSize); ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: P/Invoke BYTE *
    ... value to pDataBuffer. ... public static extern void myfunction(IntPtr myhandle, Byte byAddress, ... bytepDataBuffer, int iSize); ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: P/Invoke BYTE *
    ... Paul G. Tobey wrote: ... value to pDataBuffer. ... bytepDataBuffer, int iSize); ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: P/Invoke BYTE *
    ... It won't change - a byte array is passed by ref, so your driver can write to ... value to pDataBuffer. ... bytepDataBuffer, int iSize); ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: P/Invoke BYTE *
    ... I want the driver (dll function) to return ... value to pDataBuffer. ... bytepDataBuffer, int iSize); ... right declaration for BYTE * in platform invoke? ...
    (microsoft.public.dotnet.framework.compactframework)

Loading