[Mono-devel-list] [patch]Patch DllNotFoundException triggered for missing unmanaged libraries

Denis Gervalle dgl at softec.st
Wed Jun 2 04:58:29 EDT 2004


Oopss

I forget the attached patch, here it is...
Sorry,

Denis Gervalle
-------- Original Message --------
Subject: 	[Mono-devel-list] [patch]Patch DllNotFoundException triggered
for missing unmanaged libraries
Date: 	Wed, 02 Jun 2004 10:50:00 +0200
From: 	Denis Gervalle <dgl at softec.st>
To: 	mono-devel-list at ximian.com
CC: 	lupus at ximian.com, tauberer at for.net
References: 	<40AA7986.9030104 at softec.st>



Here is an updated patch against Beta2 to introduce a better error
reporting when loading unmanaged libraries. It needs MONO_DEBUG to be
define.

Hope we will get checked-in this time or at least receive some comments
on why we are not.

For those who have missed the full story, here is a summuary:
We have written this patch (and enhance it latter) after seaching hard
in the dark why a dynamic library next to our mono assembly is
presumably not found (DllNotFoundException) by mono.
The attached patch (based on the beta release) modify the triggered
exception when MONO_DEBUG is defined to provide a larger error message
corresponding to the joined error message of all tries done using
g_module_open(). Here is a sample:

Unhandled Exception: System.DllNotFoundException: Trying libsample.so:
libsample.so: cannot open shared object file: No such file or directory
==> Trying ./libsample.so: ./libsample.so: cannot open shared object
file: No such file or directory ==> Trying sample.so:
libdependancy.so.0: cannot open shared object file: No such file or
directory

This patch also provide a detailled error report of missing entry points
in unmanaged library using the same technique.
This patch takes care of mint issues and mono pinvoke-wrapper issues.
For the latter, each exception messages are allocated permanently on the
heap since the exception is triggered by the wrapper code for each call
to a function from the missing library (and not during the loading
phase). This is why MONO_DEBUG is required to activate the code, since
it could leak memory if a lot of missing library are tried.


Denis Gervalle
SOFTEC sa
http://www.softec.st

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


-------------- next part --------------
A non-text attachment was scrubbed...
Name: loadmodule.0.95.unified.diff.patch
Type: text/x-patch
Size: 6088 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040602/3c150be1/attachment.bin 


More information about the Mono-devel-list mailing list