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

Jonathan Pryor jonpryor at vt.edu
Wed Sep 20 21:35:23 EDT 2006

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.

So, one last question: how did you declare your DllImport method?

	[DllImport ("KeyWin32.dll")] private static extern ...

	[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

More information about the Mono-list mailing list