[Mono-list] [mono-list]DLL Import errors

Jonathan Pryor jonpryor at vt.edu
Wed Apr 18 07:21:06 EDT 2007


On Tue, 2007-04-17 at 14:40 -0500, Eric Morgan wrote:
> I'm trying to P/Invoke into a library from my csharp code, but I keep
> getting System.DllNotFoundException errors.
> 
> I've double checked my config file and the dllmap is correct.
> I've made sure the library can be found in the LD_LIBRARY_PATH
> environment variable.

Run your app with the following environment variables set:

	export MONO_LOG_LEVEL=info
	export MONO_LOG_MASK=dll

Numerous messages will be printed to the console whenever Mono attempts
to load a library, and one of these messages should be why the library
can't be loaded.

Frequently the problem is that the library is improperly linked; mono
(effectively) loads libraries using dlopen(3) with RTLD_NOW set, so if
your library depends on a symbol from another library but wasn't linked
against that library, you will get errors loading it.

You can also use http://www.jprl.com/dltest.c to test this scenario (see
the comments for compile commands).

If that still fails, you can reply to the mailing list with the Mono
output attached.

 - Jon




More information about the Mono-list mailing list