[Mono-list] System.DllNotFoundException

Martin Welch martin@welch.eclipse.co.uk
Thu, 8 Apr 2004 19:39:46 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C41DA1.3F83F810
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I have a simple c# app trying to PInvoke to a shared library on my Mandrake
10 box using Mono-0.31.

I assumed that mono would look in the current directory but it seems my
assumption is wrong since the so in question does exist.

I'm even hardcoding the path in my DllImport attribute:

  [
  DllImport
  (
  "/home/martin/source/foo",
  EntryPoint="MyFunc",
  CharSet=CharSet.Ansi,
  CallingConvention=CallingConvention.Cdecl
  )
  ]
  private static extern IntPtr MyFunc(int v,
[MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr)]
string[] a, string n);

Please bear in mind that I'm not a very experienced linux user so in all
likelihood I've done something profoundly stupid or overlooked something
really obvious.

Where does mono look for so's?

Thanks,

Martin

------=_NextPart_000_0007_01C41DA1.3F83F810
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D128442718-08042004>I =
have a simple c#=20
app trying to PInvoke to a shared library on my Mandrake 10 box using=20
Mono-0.31.</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D128442718-08042004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D128442718-08042004>I =
assumed that=20
mono would look in the current directory but it seems my assumption is =
wrong=20
since the so in question does exist.</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D128442718-08042004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D128442718-08042004>I'm =
even=20
hardcoding the path in my DllImport attribute:</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D128442718-08042004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D128442718-08042004>&nbsp;&nbsp;[<BR>&nbsp;&nbsp;DllImport<BR>&nbs=
p;&nbsp;(<BR>&nbsp;&nbsp;"/home/martin/source/foo",=20
<BR>&nbsp;&nbsp;EntryPoint=3D"MyFunc", =
<BR>&nbsp;&nbsp;CharSet=3DCharSet.Ansi,=20
<BR>&nbsp;&nbsp;CallingConvention=3DCallingConvention.Cdecl<BR>&nbsp;&nbs=
p;)<BR>&nbsp;&nbsp;]<BR>&nbsp;&nbsp;private=20
static extern IntPtr MyFunc(int v, [MarshalAs(UnmanagedType.LPArray,=20
ArraySubType=3DUnmanagedType.LPStr)] string[] a, string=20
n);<BR></SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D128442718-08042004>Please bear in=20
mind that I'm not a very experienced linux user so in all likelihood =
I've done=20
something profoundly stupid or overlooked something really=20
obvious.</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D128442718-08042004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D128442718-08042004><SPAN=20
class=3D128442718-08042004>Where does mono look for so's?=20
</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D128442718-08042004><SPAN=20
class=3D128442718-08042004></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D128442718-08042004><SPAN=20
class=3D128442718-08042004>Thanks,</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D128442718-08042004><SPAN=20
class=3D128442718-08042004></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D128442718-08042004><SPAN=20
class=3D128442718-08042004>Martin</SPAN></DIV></SPAN></FONT></BODY></HTML=
>

------=_NextPart_000_0007_01C41DA1.3F83F810--