2

I've read and successfully tried the answer to How can I pass a Delphi string to a Prism DLL?, but wondered if it was possible to use a similar method to pass a Delphi array of integers (static or dynamic) to a Prism DLL.

Community
  • 1
  • 1

2 Answers2

0

The simpliest (without marshalling) is to encode the array using BASE16 or BASE64 into a unicode string and pass a string.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
0

I don't have time to write a full working example but here are the key things to adapt the example you mention in the other question:

declare a type with your buffer length

type
  [MarshalAs(UnmanagedType.LPArray)]
  TBuffer = array[0..-length-]of integer;

and to make operations in the buffer remember to use the "pinned" modifier

var BufferPointer: ^TBuffer; pinned;

...

  BufferPointer := @the_buffer[0];
someone
  • 916
  • 1
  • 5
  • 8
  • Thanks. I'm useless at this an would really appreciate a full example if anyone has the time and willing. Your minutes will save me hours. Not in any rush. – Warren Stanley Sep 13 '10 at 12:18