Import a dll written in delphi into C#

  • Thread starter Thread starter Michael Schneider
  • Start date Start date
M

Michael Schneider

Hi there!

I want to import a dll that is written in borland delphi.

The function looks as follow:
DLLEXP HRESULT DLLCALL LoadFromFile( char * TheFileName )

My code in C#:
[DllImport( "ipascom.dll", EntryPoint = "LoadFromFile", SetLastError =
true,
CharSet = CharSet.Ansi, ExactSpelling = false,
CallingConvention = CallingConvention.StdCall )]

private static extern uint LoadFromFile( [MarshalAs(
UnmanagedType.LPStr )] string fileName );

What's wrong with this code snippet? There's a problem with the string
parameter...

Thanks,
- Michael
 
Back
Top