3

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

JoshDM
  • 4,939
  • 7
  • 43
  • 72
technomage
  • 525
  • 4
  • 14
  • 1
    do you really mean c++? You can't do c++ interop on mono, only C linkage is supported via pinvoke – IanNorton Jun 11 '12 at 19:04
  • the SDK says it is for C++ development, but the library might be written in C, cause the sample code for C++ is calling the library directly (no class instantiation). Link to the SDK http://www.starmicronics.com/support/SDKDocumentation.aspx – technomage Jun 11 '12 at 23:37

1 Answers1

4

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

LD_LIBRARY_PATH=. mono yourapp.exe

knocte
  • 16,941
  • 11
  • 79
  • 125