[Mono-list] DllImport and mono

Robert Jordan robertj at gmx.net
Thu May 14 18:21:57 EDT 2009


ptr2009 wrote:
> hey all
> 
>    I am trying out the pinvoke functionality in mono.   I am using Mono 2.4
> on vista.
> 
> When I run the application natively "ConsoleApplication.exe"  it works fine.
> 
> But when I run against mono using "mono ConsoleApplication.exe" I get the
> following Exception
> 
> Unhandled Exception: System.DllNotFoundException: Adder
>   at (wrapper managed-to-native) ConsoleApplication1.Program:AddTwoNumbers
> (int,int)
>   at ConsoleApplication1.Program.Main (System.String[] args) [0x00000]
> 
> 
> The exe and the dll both reside in the same directory.  Am I missing
> something obvious to get this to work ?

Mono assumes that the native DLL is either in the PATH or
in the current directory, while MS.NET is additionally probing
the directory of the entry assembly.

I guess you've actually invoked the app like this

mono somedir/ConsoleApplication.exe

Robert



More information about the Mono-list mailing list