[Mono-list] Can't get a simple shared object to be used - DllNotFoundException
inorton at gmail.com
Tue Jul 30 22:00:21 UTC 2013
Dllimport tells the loader the library name.
A large combination of things work as library loading and shared objects
differ greatly on windows and unix.
On windows, the library could be installed in the side-by-side cache or in
the same folder as your assembly etc.
If you have a file called libfoo.so then best practice would be to do
If that still doesn't work then you may actually be missing a library
required by foo and may need to set LD_LIBRARY_PATH or the equivalent on
You might also need to mess with dllmap config files too
On 30 Jul 2013 22:35, "Stifu" <stifu at free.fr> wrote:
> I've never done that myself, but if I remember correctly, you're not
> to add the ".so" part. Just do [DllImport("libshared")]. That way, it's up
> to the framework to figure out the right extension depending on the OS it
> runs on.
> In other words, that'd mean it can't find your file because it's looking
> thomasw234 wrote
> > Hi,
> > I'm trying to get my head around making use of Linux shared object files.
> > I have created a basic C-based shared object which prints ("Shared Object
> > Called") when main() is called. Compiled it in gcc with -fPIC and got
> > libshared.so as an output.
> > Go into C#, add [DllImport("libshared.so")] public static extern int
> > main(); Call main(), get a DllNotFoundException. libshared.so is in the
> > same directory as the c# program.
> > I thought it might be a platform problem (I'm using 64 bit fedora 18, and
> > 64 bit mono 3.20), but I've tried building the shared object with both
> > -m32 and -m64 arguments, with no luck.
> > I can provide code if it helps, but the machine that I'm building is a
> > corporate machine that isn't allowed on the internet, so I'll have to
> > it out line-by-line.
> > Thanks,
> > Thomas
> View this message in context:
> Sent from the Mono - General mailing list archive at Nabble.com.
> Mono-list maillist - Mono-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list