[Mono-dev] DllNotFoundException and shared libraries

Jonathan Pryor jonpryor at vt.edu
Wed Dec 14 07:09:11 EST 2005

On Wed, 2005-12-14 at 11:11 +0100, Andrew Warinner wrote:
> I'm getting a System.DllNotFoundException when attempting to execute a
> function in a shared library that in turn executes a function in yet another
> shared library.

Mono doesn't load shared libraries.  Mono uses GLib, which in turn uses
the dlopen(3) system call to load shared libraries.

libfontinfo.so is probably linked incorrectly.  Run the following

	ldd /usr/lib/libfontinfo.so.1

If libfreetype.so isn't listed in the output, libfontinfo.so was
incorrectly linked.  The result is that the dynamic linker cannot load
the library.  For example, compile and run this program:

	wget http://www.jprl.com/dltest.c
	gcc -o dltest dltest.c -ldl
	./dltest /usr/lib/libfontinfo.so.1

No output is generated if the library is OK, and an error message will
be printed out if the library cannot be loaded.

If libfontinfo.so is incorrectly linked, you'll have to recompile it and
add a -lfreetype linker flag.  This will let ld.so know what
libfreetype.so needs to be loaded along with libfontinfo.so, allowing
libfontinfo.so to be loaded.

 - Jon

More information about the Mono-devel-list mailing list