The dllmap configuration file entry is used in Mono to map requests for windows DLLs to Linux (.so) libraries. But it seems that if Microsoft's .NET framework tries to parse a configuration file with such an entry, an error occurs because it doesn't understand "dllmap". I think everything else in my distribution can be distributed unchanged on both Linux and Windows XP. Of all the portability involved in this, is this configuration entry really the downfall -- the one non-portable piece? Isn't there a way to share this file across platforms too?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Are you sure you need the "dllmap" entries? Can't you just rely on automatic mapping "somelibrary" to "somelibrary.dll" on Windows and "somelibrary.so" on Linux?
Besides, I though the framework just skip the entries it does not expect...
EDIT: The standard way to ship linux libraries is to have an version-less symlink pointing to the latest version. So you would add libfmodex.so
pointing to libfmodex-4.22.01.so
. Then use [DllImport("fmodex")]
and the framework will figure the rest automatically.
回答2:
Place the dll importing code in a separate assembly dll. Then add a yourinterop.dll.config with the dllmap entries. It will be ignored by MS and processed by mono. See my duplicate question.