swig + mono : C# example errors of not finding the library

后端 未结 4 1943
不知归路
不知归路 2021-01-20 03:49

I use swig 2.0.1 + mono 2.6/2.8 on Mac OS X 10.6.4.

The overall build is OK, and the build of the C# examples is also OK. The problem is that when I run the example

相关标签:
4条回答
  • 2021-01-20 04:08

    System.DllNotFoundException: example

    It looks like it cannot find your unmanaged dll: "example".

    0 讨论(0)
  • 2021-01-20 04:21

    You should also ensure the file is in the dynamic linker search path, i.e. on MacOS:

    export DYLD_FALLBACK_LIBRARY_PATH="/directory/with/your/dylb/file:$DYLD_FALLBACK_LIBRARY_PATH"
    

    BTW, MacOS one would generally expect a .dylib file, not a .so file.

    0 讨论(0)
  • 2021-01-20 04:30

    This is likely caused by the library being compiled as 64-bit. The "(null)" means that Mono was not able to obtain the error message of this error. You can fix this by setting the appropriate compile flags. For instance:

    ./configure CFLAGS="-O -arch i386" CXXFLAGS="-O -arch i386" LDFLAGS="-arch i386" --disable-dependency-tracking
    

    You may also be able to fix this by using Mono's experimental 64-bit support but I have never done that so am not sure.

    0 讨论(0)
  • 2021-01-20 04:30

    You can specify what DLL the pinvoke signatures target in your interface file.

    0 讨论(0)
提交回复
热议问题