Import a dll written in delphi into C#

  • Thread starter Michael Schneider
  • 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
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top