[Mono-list] Dll loading failure

Jurek Bartuszek koxta@koxta.net
Thu, 28 Apr 2005 16:35:14 +0200


-----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-----