John Larsen

John Larsen

  • NA
  • 18
  • 10.8k

C# and C++ DLL file

Aug 29 2011 7:40 AM
Hi,

I am currently trying to write a flash programmer uisng the SiUtil.dll file from Silicon Labs.

I am having problems when trying to read the scratchpad memory.
C++ Prototype: extern "C" __declspec(dllimport) int__stdcall GetScratchPadMemory(
BYTE * ptrMem, DWORD wStartAddress, unsigned int nLength);

C#
[DllImport(@"C:\temp\SiUtil.dll")]
public static extern int GetScratchPadMemory(ref byte Data, uint AddressToRead, uint Lenght);

I am sure there is some problems with how I declare this, but I do not know how to fix it.
I hope someone can guide me towards the correct way to do this.

Regards
John-Ove

Answers (4)