Mono shared library under linux location

2020-04-11 08:17发布

问题:

I have a shared library written in C++ that I'd like to use with Mono under Linux, I follow this guide http://www.mono-project.com/Interop_with_Native_Libraries

I got it to work, but I have to put my library file into /usr/lib or /lib folder.

Is there anyway that I could distribute and use my .so files and not copy them into /usr/lib or /lib but instead into my Mono application folder ? (current directory where the app running)

some user using the software might not have root / admin access, therefore they can't install/copy the files into /usr/lib or /lib

回答1:

I think you have to use the environment variable LD_LIBRARY_PATH when launching your program:

LD_LIBRARY_PATH=. mono yourapp.exe