I have this function defined in a delphi code:
procedure TestFLASHWNew(
name: array of string;
ID: array of Integer;
var d1:double
); stdcall;
How can I define and call it from C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a bit of a messy P/Invoke because you can’t (to the best of my admittedly limited knowledge) use any of the built-in easy marshalling techniques. Instead you need to use
Marshal.StructureToPtrlike this:C#
Delphi
I’ve implemented it with a wrapper function that calls your
TestFLASHWNewfunction but you’ll no doubt want to re-work it.I’ve assumed you are using a Delphi with Unicode strings. If not then change
[MarshalAs(UnmanagedType.LPWStr)]to[MarshalAs(UnmanagedType.LPStr)].