[Mono-list] DDllImport .config file does not work

David Abrames abramesd at kmbs.konicaminolta.us
Thu Sep 21 08:10:51 EDT 2006



> -----Original Message-----
> From: Jonathan Pryor [mailto:jonpryor at vt.edu]
> Sent: Wednesday, September 20, 2006 9:35 PM
> To: abramesd at kmbs.konicaminolta.us
> Cc: mono-list at lists.ximian.com
> Subject: Re: [Mono-list] DDllImport .config file does not work
>
>
> On Wed, 2006-09-20 at 10:25 -0400, David Abrames wrote:
> > Thank you for your reply.  I ran my program as you suggested
> and the output
> > I am getting shows how mono is trying to find the shared object
> by mangling
> > the original library name.  For example it adds '.so' to the
> end and 'lib'
> > to the beginning and then tries about a dozen various
> combinations of this.
> > However none of these match the actual shared object name.
> >
> > I removed the MONO_LOG_MASK=dll from your suggestion and the
> display shows
> > that mono is looking for the .config file in the correct
> location but does
> > not appear to find it as it also looks for it in
> '/etc/mono/assemblies/' and
> > '/home/david/.mono/assemblies/'.  I copied my .config file to the other
> > locations using the same name that mono appears to be looking for and it
> > still does not appear to find the .config file.
>
> Just because it finds a .config file doesn't mean it stops looking for
> other .config file locations.  It'll keep looking until it can load the
> requested library or fail.

OK that makes sense but my statement was base on the other log entries that
seemed to show when a remapping worked, mono stopped looking(loading) config
files and issued a remapping warning message.

>
> So, one last question: how did you declare your DllImport method?
>
> (A)
> 	[DllImport ("KeyWin32.dll")] private static extern ...
>
> (B)
> 	[DllImport ("KeyWin32")] private static extern ...
>
> Given your .config file (which remaps "KeyWin32.dll"), you need to use
> (A) or else the .config file searching won't find a match.  Since (B)
> doesn't match the .config file, it will result in a failed remapping.
>
>  - Jon

I am using (A).  I have checked and re-checked that the library name I am
using "KeyWin32.dll" on the DllImport statement is also the same on the
dllmap attribute in the dll.comfig file.  I have also made sure that the
name of the dll.config file is correct and that the dll.config file is in
the same folder as the dll file.

>From our discussion so far it would appear that there are four ways this
could fail.

(1) mono can't locate the dll.config file.
(2) mono can't parse the dll.config file.
(3) mono can't match a DllImport entry to a dllmap entry.
(4) mono can't locate the mapped shared object file.

Id there a way to determine which of the above is the problem?  Knowing that
might lead to a solution.

David Abramaes




More information about the Mono-list mailing list