From mono-list Thu Apr 08 22:25:35 2004 From: "Martin Welch" Date: Thu, 08 Apr 2004 22:25:35 +0000 To: mono-list Subject: RE: [Mono-list] System.DllNotFoundException Message-Id: X-MARC-Message: https://marc.info/?l=mono-list&m=108146323316551 MIME-Version: 1 Content-Type: multipart/mixed; boundary="------=_NextPart_000_0011_01C41DC0.CB8DA300" This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C41DC0.CB8DA300 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I'm making progress. My library foo.so comprises two cpp files that only contain extern "C" functions. If i build this library and PInvoke to it everything's ok. If I then add another cpp file, this time with a class definition and implementation then I get the System.DllNotFoundException, even if the class isn't referenced by the extern "C" functions. Take the cpp file out and it works again. Is this making sense? What am I doing wrong? Thanks, Martin -----Original Message----- From: mono-list-admin@lists.ximian.com [mailto:mono-list-admin@lists.ximian.com]On Behalf Of Martin Welch Sent: 08 April 2004 19:40 To: Mono-List Subject: [Mono-list] System.DllNotFoundException 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_0011_01C41DC0.CB8DA300 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I'm=20 making progress.
 
My=20 library foo.so comprises two cpp files that only contain extern "C"=20 functions.
 
If i=20 build this library and PInvoke to it everything's = ok.
 
If I=20 then add another cpp file, this time with a class definition and = implementation=20 then I get the System.DllNotFoundException, even if the class isn't = referenced=20 by the extern "C" functions.
 
Take=20 the cpp file out and it works again.
 
Is=20 this making sense? What am I doing wrong?
 
Thanks,
 
Martin
-----Original Message-----
From:=20 mono-list-admin@lists.ximian.com=20 [mailto:mono-list-admin@lists.ximian.com]On Behalf Of Martin=20 Welch
Sent: 08 April 2004 19:40
To:=20 Mono-List
Subject: [Mono-list]=20 System.DllNotFoundException

I = have a simple=20 c# app trying to PInvoke to a shared library on my Mandrake 10 box = using=20 Mono-0.31.
 
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.
 
I'm even=20 hardcoding the path in my DllImport attribute:
 
  [
  DllImport
&nbs= p; (
  "/home/martin/source/foo",=20
  EntryPoint=3D"MyFunc", =
  CharSet=3DCharSet.Ansi,=20 =
  CallingConvention=3DCallingConvention.Cdecl
 &nbs= p;)
  ]
  private=20 static extern IntPtr MyFunc(int v, [MarshalAs(UnmanagedType.LPArray,=20 ArraySubType=3DUnmanagedType.LPStr)] string[] a, string=20 n);
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.
 
Where does mono look for so's?=20
 
Thanks,
 
Martin
= ------=_NextPart_000_0011_01C41DC0.CB8DA300-- _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list