Re: Problem with DllImport
- From: "Jani Järvinen [MVP]" <janij@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 29 May 2007 07:01:43 +0300
Hello!
I load an external library written in Delphi (I don't have any source
code of this lib). I do it in this way:
[System.Runtime.InteropServices.DllImport("myLib.dll",
EntryPoint="externalMethod")]
public static extern bool userExist(string userName, string password);
Just a quick note: your trouble can be caused by Delphi's string types.
Depending on which Delphi version was used to build the DLL, the Delphi
strings can be different from what C# (.NET) expects. The safest thing is to
use PChars in Delphi code when interoperability is expected.
But when I close the program I get 2 errors.
1. "Unknown exception code (0x0eedfade) occurred at 0x7c81eb33."
2. "Runtime error 217 at 00009DF8"
Have you tried to call the DLL from a Delphi host application? Does the
error occur then? Either the DllImport signature is incorrect (like Nicholas
already suggested) or the Delphi DLL is incorrectly programmed. For example,
and object is freed twice upon shutdown, or used after it has been freed.
If you have the source code for the Delphi DLL, double-check to see how it
should be used (see again Nicholas' reply) or there are bugs in the DLL
code.
--
Regards,
Mr. Jani Järvinen
C# MVP
Helsinki, Finland
janij@xxxxxxxxxxxxxxxxxxxxxx
http://www.saunalahti.fi/janij/
.
- Prev by Date: Re: Release build not optimizing
- Next by Date: Re: Convert string to HorizontalAlign value
- Previous by thread: Re: Problem with DllImport
- Next by thread: BindingSource Removing Current Row
- Index(es):
Relevant Pages
|