[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-list
Subject:    RE: [Mono-list] System.DllNotFoundException
From:       "Martin Welch" <martin () welch ! eclipse ! co ! uk>
Date:       2004-04-08 22:25:35
Message-ID: GIEKKMAAMELBNKEJJKHGMEJECMAA.martin () welch ! eclipse ! co ! uk
[Download RAW message or body]

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

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN \
class=498461922-08042004>I'm  making progress.</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=498461922-08042004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN \
class=498461922-08042004>My  library foo.so comprises two cpp files that \
only contain extern "C"  functions.</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=498461922-08042004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN \
class=498461922-08042004>If i  build this library and PInvoke to it \
everything's ok.</SPAN></FONT></DIV> <DIV><FONT face=Verdana color=#0000ff \
size=2><SPAN  class=498461922-08042004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN \
class=498461922-08042004>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.</SPAN></FONT></DIV> <DIV><FONT face=Verdana \
color=#0000ff size=2><SPAN  \
class=498461922-08042004></SPAN></FONT>&nbsp;</DIV> <DIV><FONT face=Verdana \
color=#0000ff size=2><SPAN class=498461922-08042004>Take  the cpp file out \
and it works again.</SPAN></FONT></DIV> <DIV><FONT face=Verdana \
color=#0000ff size=2><SPAN  \
class=498461922-08042004></SPAN></FONT>&nbsp;</DIV> <DIV><FONT face=Verdana \
color=#0000ff size=2><SPAN class=498461922-08042004>Is  this making sense? \
What am I doing wrong?</SPAN></FONT></DIV> <DIV><FONT face=Verdana \
color=#0000ff size=2><SPAN  \
class=498461922-08042004></SPAN></FONT>&nbsp;</DIV> <DIV><FONT face=Verdana \
color=#0000ff size=2><SPAN  \
class=498461922-08042004>Thanks,</SPAN></FONT></DIV> <DIV><FONT \
face=Verdana color=#0000ff size=2><SPAN  \
class=498461922-08042004></SPAN></FONT>&nbsp;</DIV> <DIV><FONT face=Verdana \
color=#0000ff size=2><SPAN  \
class=498461922-08042004>Martin</SPAN></FONT></DIV> <BLOCKQUOTE dir=ltr \
style="MARGIN-RIGHT: 0px">  <DIV class=OutlookMessageHeader dir=ltr \
align=left><FONT face=Tahoma   size=2>-----Original \
Message-----<BR><B>From:</B>   mono-list-admin@lists.ximian.com 
  [mailto:mono-list-admin@lists.ximian.com]<B>On Behalf Of </B>Martin 
  Welch<BR><B>Sent:</B> 08 April 2004 19:40<BR><B>To:</B> 
  Mono-List<BR><B>Subject:</B> [Mono-list] 
  System.DllNotFoundException<BR><BR></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004>I have a \
simple   c# app trying to PInvoke to a shared library on my Mandrake 10 box \
using   Mono-0.31.</SPAN></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN 
  class=128442718-08042004></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004>I assumed \
that   mono would look in the current directory but it seems my assumption \
is wrong   since the so in question does exist.</SPAN></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN 
  class=128442718-08042004></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004>I'm even 
  hardcoding the path in my DllImport attribute:</SPAN></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN 
  class=128442718-08042004></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana size=2><SPAN 
  class=128442718-08042004>&nbsp;&nbsp;[<BR>&nbsp;&nbsp;DllImport<BR>&nbsp;&nbsp;(<BR>&nbsp;&nbsp;"/home/martin/source/foo", \
  <BR>&nbsp;&nbsp;EntryPoint="MyFunc", \
<BR>&nbsp;&nbsp;CharSet=CharSet.Ansi,   \
<BR>&nbsp;&nbsp;CallingConvention=CallingConvention.Cdecl<BR>&nbsp;&nbsp;)<BR>&nbsp;&nbsp;]<BR>&nbsp;&nbsp;private \
  static extern IntPtr MyFunc(int v, [MarshalAs(UnmanagedType.LPArray, 
  ArraySubType=UnmanagedType.LPStr)] string[] a, string 
  n);<BR></SPAN></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004>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.</SPAN></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN 
  class=128442718-08042004></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004><SPAN 
  class=128442718-08042004>Where does mono look for so's? 
  </SPAN></SPAN></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004><SPAN 
  class=128442718-08042004></SPAN></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004><SPAN 
  class=128442718-08042004>Thanks,</SPAN></SPAN></FONT></DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004><SPAN 
  class=128442718-08042004></SPAN></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana size=2><SPAN class=128442718-08042004><SPAN 
  class=128442718-08042004>Martin</SPAN></DIV></BLOCKQUOTE></SPAN></FONT></BODY></HTML>



_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic