How Unicode strings can be passed from a managed to an unmanaged function...

Posted by Who Cares on Stack Overflow See other posts from Stack Overflow or by Who Cares
Published on 2010-05-31T05:48:00Z Indexed on 2010/05/31 5:52 UTC
Read the original article Hit count: 397

Filed under:
|

I will really appreciate anybody's help about how a Unicode string can be passed (marshaled) from a managed (Delphi .NET) to an unmanaged (Delphi's Win32 DLL) function.

The managed environment (Delphi .NET):

...

interface

...

const TM_PRO_CONVERTER = 'TM.PROFileConverter.dll';

function ImportLineworksFromPROFile(FileName :String; TargetFileNameDXF :String): Integer;

...

implementation

...

[DllImport(TM_PRO_CONVERTER, EntryPoint = 'ImportLineworksFromPROFile', CharSet = CharSet.Ansi, SetLastError = True, CallingConvention = CallingConvention.StdCall)]

function ImportLineworksFromPROFile(FileName :String; TargetFileNameDXF :String): Integer; external;

...

The unmanaged environment (Delphi's Win32 DLL):

library TM.PROFileConverter;

...

function ImportLineworksFromPROFile(FileName :String; TargetFileNameDXF :String) :Integer; stdcall;

exports ImportLineworksFromPROFile;

...

Thank you for your time.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about delphi-2007