App.config dllmap entry portability

左心房为你撑大大i 提交于 2019-12-24 01:15:53

问题


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.



来源:https://stackoverflow.com/questions/967456/app-config-dllmap-entry-portability

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!