4
Reply

C# and C++ DLL file

John Larsen

John Larsen

13 years ago
2.5k
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)