views:

62

answers:

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.

A: 

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

Eugene Mayevski 'EldoS Corp
A: 

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
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