[Mono-list] DllImportMap support in mono?

Paolo Molaro lupus@ximian.com
Tue, 15 Jul 2003 15:08:58 +0200

On 07/13/03 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. 

We're not going to implement the DllImportMap attribute, because
it doesn't really solve the issue and it would be a pain to support.
It doesn't solve the issue because it doesn't allow the _user_ of the
assembly to decide how the dll name is mapped on a per-system or
per-user basis, but only to the original developer of the assembly (or
you need to change the sources in god only knows how many places and
recompile). It is a support nightmare because either you export the
DllImportMap attribute from mscorlib and as such the assembly won't be
compatible with other runtimes, or you need to stick the attribute in
all the assemblies that use it, duplicating work, bloating the code both
in the assembly and in the runtime.
Mono uses a different mechanism (the ddlmap entries in the configuration
files described in mono-config) that addresses all the issues above
and also solves the actual problem (plus it lets you map also individual
method name entries).


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better