P/Invoke to dynamically loaded library on Mono

后端 未结 4 854

I\'m writing a cross-platform .NET library that uses some unmanaged code. In the static constructor of my class, the platform is detected and the appropriate unmanaged library

4条回答
  •  旧巷少年郎
    2021-02-02 00:59

    Not sure why you think this is related to mono, since the issue you're having is not about mono's dynamic loading facilities.

    If your updated sample works, it just means that LoadLibrary() on windows has different semantics than dlopen() on Linux: as such you either have to live with the difference or implement your own abstraction that deals with the directory issue (my hunch is that it's not the directory that is retained, but windows simply looks to see if a library with the same name was already loaded and it reuses that).

提交回复
热议问题