[Mono-dev] DllImports cannot load an .so that references another .so (on Ubuntu)

hpavlov hristo_dpavlov at yahoo.com
Tue Nov 27 23:36:39 UTC 2012

I have a Mono application that uses PInvoke to call methods from two native
libraries, lets call them /libBase.so/ and /libSuper.so/. All files are in
the same place - the shared libraries and the .NET executable. 

The application locates the libBase.so with no problem and calls one of the
native methods, as evident from the log file below:

/Mono: DllImport loading library: '/home/hristo/MonoApp/libBase.so'.
Mono: Searching for 'GetProductVersion'.
Mono: Probing 'GetProductVersion'.
Mono: Found as 'GetProductVersion'./

The problem is with the second library (/libSuper.so/) which also happens to
use natively the first library (/libBase.so/) being linked to it as a shared
library. When Mono tries to load the second library it returns the following

/Mono: DllImport loading library: '/home/hristo/MonoApp/libSuper.so'.
Mono: DllImport error loading library 'libBase.so: cannot open shared object
file: No such file or directory'./

Looks like when trying to load the /libSuper.so/, Mono also tries to load
the referenced /libBase.so /but it doesn't find it, neither the log gives
details about the location where it is looking for it.

Does anyone have any suggestions on how to make both libraries be loaded
okay and run by PInvoke preferably without modifying system configuration
files (of Mono or ld)? Or if you can help me find out where Mono expects the
/libBase.so/ to be located when loading /libSuper.so/?

View this message in context: http://mono.1490590.n4.nabble.com/DllImports-cannot-load-an-so-that-references-another-so-on-Ubuntu-tp4657554.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list