[Mono-dev] DllMap default architecture for P/Invoke
jcurlnews at arcor.de
Sat Jan 16 13:08:36 UTC 2016
I've created a DLL compiled for linux x86-64 and mapping this using
P/Invoke. I'd like to know how a [DllImport("mylib")] can be instructed
to look for the architecture specific library, and if not found, then a
default (probably locally compiled) library for testing.
What I've done until now:
I've created an assembly configuration as per
http://www.mono-project.com/docs/advanced/pinvoke/dllmap/ that looks like:
<?xml version="1.0" encoding="utf-8">
<dllmap dll="libnserial" os="linux" cpu="x86-64"
<dllmap dll="libnserial" target="libnserial.so" />
The DLL import is:
public static extern IntPtr serial_version();
The final distribution for the application is expected to have (notice,
=> The configuration with Mono 4.2.1 fails with
I remove the second dllmap and it works as expected. But in case the
user builds themselves for local testing and usage, they'll get for
their current architecture an additional library, where I want the
second line to be a fallback in case the library can't be found.
libnserial.so -> libnserial.so.1
libnserial.so.1 -> libnserial.so.1.0
How would I handle this scenario within Mono?
More information about the Mono-devel-list