[Mono-list] Can't get a simple shared object to be used - DllNotFoundException

Stifu stifu at free.fr
Tue Jul 30 21:34:24 UTC 2013


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.


More information about the Mono-list mailing list