[Mono-list] DllImportMap support in mono?

Jonathan Pryor jonpryor@vt.edu
13 Jul 2003 20:24:51 -0400

Mono chose to solve this in a different way.  Mono uses a "config" file
(located in $prefix/etc/mono/config), which is an XML file with the
following structure:

	  <dllmap dll="cygwin1.dll" target="libc.so.6" />
	  <dllmap dll="gtkhtml-3.0" target="libgtkhtml-3.0.so.2" />
	  <!-- ... -->

The "dll" should be the same string as the library name used in the
DllImport statement, and "target" is the library that mono should
actually load.

The config file is platform-dependent, so the Unix version will have
different "target" values than the Win23 version.

By convention, Mono-written assemblies uses the Win32 library names in
DllImport statements (so Gtk# DllImports "libgtk-win32-2.0-0.dll"),
allowing the assemblies to run unchanged under .NET.  Mono provides the
config file to change this for mono-supported platforms (Linux).

 - Jon

On Sun, 2003-07-13 at 12:25, David Jeske wrote:
> I was looking at using the "pnetcurses" library which maps ncurses
> into C#. Portable.NET uses an attribute called DllImportMap to handle
> mapping function imports to different shared library names based on
> the platform. 
> Miguel seemed to think it was a neat idea way back when:
>  http://archive.neotonic.com/archive/mono-list/msg/2153
> However, this hasn't show up in Mono. I'm wondering if this is
> something that nobody has implemented, or if Mono has just chosen to
> solve this a different way.