DelphiN00b
Programmer
- Jul 13, 2011
- 1
I'm having troubles working a return array from a Delphi5-6 Dll within C#
My.dll communicates between the PC and a PIC and works in the Delphi created test.exe
Delphi
returns the TData as a byte array.
C#
As My.dll does the PC to PIC exchange, am I correct in assuming the MemAdr and MemLen only need to be passed as integers?
Only the returned array TData or Byte[] needs to be Marshalled, correct?
How would I Marshal the returning Array?
My.dll communicates between the PC and a PIC and works in the Delphi created test.exe
Delphi
Code:
function GetArray1(MemAdr, MemLen: integer): TData; stdcall; external 'My.dll';
C#
Code:
[DllImport("My.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public static extern byte[] GetArray1(int MemAdr, int MemLen);
As My.dll does the PC to PIC exchange, am I correct in assuming the MemAdr and MemLen only need to be passed as integers?
Only the returned array TData or Byte[] needs to be Marshalled, correct?
How would I Marshal the returning Array?