Donald C

Donald C

  • NA
  • 153
  • 3.4k

Passing a string to an unsafe struct.

May 18 2016 3:45 PM
Hi Guys,
 
I need to interact with some old Delphi DLLs.
Unfortunately they use the Delphi shortstring variable.
Im having trouble accessing the DLL functions, Im trying to pass in a string parameter when the function requires a Delphi shortstring variable.
 
I found a reply online which suggested using a struct to create the shortstring variable in c#
http://stackoverflow.com/questions/30569111/how-can-i-marshal-a-delphi-short-string-using-p-invoke 
 
I've pasted in the unsafe struct DelphiShortString struct to my code, but Im now having trouble passing the string to the struct. 
 
DelphiShortString variablename; 
 
How to I pass a string to variablename?
 
Thanks for your help. 
 
 
 
 
 

Answers (2)