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 DllImport("foo") 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 your platform. You might also need to mess with dllmap config files too On 30 Jul 2013 22:35, "Stifu" <st...@free.fr> wrote: > I've never done that myself, but if I remember correctly, you're not > supposed > 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 > for > "libshared.so.so". > > > 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 > copy > > it out line-by-line. > > > > Thanks, > > Thomas > > > > > > -- > View this message in context: > http://mono.1490590.n4.nabble.com/Can-t-get-a-simple-shared-object-to-be-used-DllNotFoundException-tp4660332p4660334.html > Sent from the Mono - General mailing list archive at Nabble.com. > _______________________________________________ > Mono-list maillist - Mono-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-list >
_______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list