Problem with method signatures and P/Invoke

  • Thread starter Thread starter t4urean
  • Start date Start date
T

t4urean

I am involved in a project whereby I have to use a methods from a Win32 dll.
There are two methods for which I can't write signature in C#

I have even tried using p/invoke wizard, but it didn't gave the right answer.

The C/C++ declaration for these methods is

BOOL __stdcall CodecStart(int hRadio,void __stdcall (*CallbackFunc)(void *),
void *CallbackTarget);
and

DWORD __stdcall CodecRead(int hRadio, void *Buf, DWORD Size);

I would highly appreciate if any2 can suggest the signature that I can use in
C#
 
BOOL __stdcall CodecStart(int hRadio,void __stdcall (*CallbackFunc)(void *),
void *CallbackTarget);
and

DWORD __stdcall CodecRead(int hRadio, void *Buf, DWORD Size);

I would highly appreciate if any2 can suggest the signature that I can use in
C#

delegate void CallbackFunc(IntPtr p);

static extern bool CodecStart(int hRadio, CallbackFunc func, IntPtr
CallbackTarget);

static extern uint CodecRead(int hRadio, byte[] Buf, uint Size);

You can adjust the type of the Buf parameter to a certain degree to
fit the type of data you'll actually read.


Mattias
 
Back
Top