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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]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

Reply via email to