Re: P/Invoke BYTE *
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Thu, 27 Jul 2006 16:22:18 -0700
A call back or some data copied into the buffer passed as a parameter? A
callback is going to require a rather different scheme (look up delegates in
the help or in the archives of this group). If you just want to copy some
data into a pre-allocated managed array in your unmanaged code, go ahead.
Paul T.
"Mario" <alphatommy@xxxxxxxxxxx> wrote in message
news:1154041731.172840.235320@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Paul,
Your suggestion worked great. Thanks.
I have another question. How would the declaration different if the
function needs a call back. I want the driver (dll function) to return
value to pDataBuffer. Thanks.
Paul G. Tobey [eMVP] wrote:
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.
.
- Follow-Ups:
- Re: P/Invoke BYTE *
- From: Mario
- Re: P/Invoke BYTE *
- References:
- P/Invoke BYTE *
- From: Mario
- Re: P/Invoke BYTE *
- From: Paul G. Tobey [eMVP]
- Re: P/Invoke BYTE *
- From: Mario
- P/Invoke BYTE *
- Prev by Date: Re: P/Invoke BYTE *
- Next by Date: Re: GetHostEntry
- Previous by thread: Re: P/Invoke BYTE *
- Next by thread: Re: P/Invoke BYTE *
- Index(es):
Relevant Pages
|
Loading