docs/design/features/dllmap.md
DllMap is a mechanism to influence native library load resolution via a name mapping. DllMap feature facilitates writing platform-agnostic library invocations (pInvoke) in managed code, while separating the platform-specific naming details to a separate configuration file. This document describes how DllMap can be realized in .Net Core.
Mono implements Dllmap using an XML configuration for name mappings. For example:
<configuration>
<dllmap dll="MyLib.dll" target="YourLib.dll"/>
<dllmap os="windows" dll="libc.so.6" target="cygwin1.dll"/>
</configuration>
Mono also permits mapping of method names within libraries, but with the restriction that the original and mapped methods must have the same signature. This document does not deal with mapping method names or signatures.
.Net Core 3 provides a rich set of APIs to manage native libraries, as well as callbacks to influence native library resolution.
Load(), Free(), get the address of an exported symbol, etc.) in a platform-independent way from managed code.These APIs can be used to implement custom native library resolution logic, including Mono-style DllMap.
A sample implementation of DLLMap using the NativeLibrary APIs is here: DllMap Sample.