[Mono-list] Dll loading failure

Michal Moskal Michal Moskal <michal.moskal@gmail.com>
Thu, 28 Apr 2005 19:11:36 +0200


On 4/28/05, Jurek Bartuszek <koxta@koxta.net> wrote:
> > Mono does not support native code DLLs from Windows when running on Lin=
ux.
> Are you 100% sure about that?

No. Maybe some wine interop would do? I'm not an expert here.

> > I guess mono searches in the current directory. But failing to recogniz=
e
> > the file format, it says it cannot find (usable) DLL.
> Well... I've spent some time before I noticed that I have to export '.'
> or `pwd` into LD_LIBRARY_PATH in order to make mono look up the .so file
> in current directory. Without that I've been recieving
> System.DllNotFoundException either. I wonder if there is an enviroment
> variable responsible for listing dll dirs (I tried CSCC_LIB_PATH, but it
> didn't work. I think it's a var that is being used by mcs, not mono).

You don't have to, and you shouldn't link the dlls used by P/Invoke using
the compiler. It is a dynamic mechanism.

> > Only managed code (ones containing IL byte code, not native x86 machine
> > code) DLLs will work.
> Hm... is there any way to generate such dlls?

Yeah, any .NET compiler will do (mcs, csc, ilasm, ncc...). But you cannot
generate .NET byte code out of an x86 assembly language. And of course
there is no need (or way) to use P/Invoke with managed code.

--=20
   Michal Moskal,
   http://nemerle.org/~malekith/