Hi, I think you need to set up your LD_LIBRARY_PATH variable. I have a simple interop sample I did with mono here:
http://turchin.net/mono/interoptest.tar.gz that you could look at for reference (see the READM). it creates a shared library, uses it in a c-program and also uses it via DllImport in a c#-program. HTH. Best Regards, --chris On Thu, 28 Apr 2005, Jurek Bartuszek wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi! > > What do I have to provide in order to load a dll in C# (mono/mcs)? > > This piece of code has been compiled using mcs. > > using System; > using System.Runtime.InteropServices; > > public class Hello { > > [DllImport("dodaj.dll")] > public static extern int Add(int a, int b); > > public static int Main() { > > Console.WriteLine("Your sum: {0}", Add(2,3)); > > return 0; > } > } > > Executed on windows, dodaj.dll is being found and a result of 5 is being > displayed. However, when I run `mono main.exe` on Linux, I still keep > getting this exception: > > $ mono main.exe > > Unhandled Exception: System.DllNotFoundException: dodaj.dll > in (wrapper managed-to-native) Hello:Add (int,int) > in <0x0000f> Hello:Main () > > Is there any system variable that should be set, or else? > > Regards, > > Jurek Bartuszek > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.1 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFCcPSh6l8uJkeTVlMRAuL+AJ4mWO59j+Cr6p6CpGQM7ijxelPamwCgxiQO > 3ni/q1sXEJ8X+Vtoh0tsANo= > =XSpp > -----END PGP SIGNATURE----- > _______________________________________________ > Mono-list maillist - [email protected] > http://lists.ximian.com/mailman/listinfo/mono-list > _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
