[Mono-list] Dll loading failure

Michal Moskal Michal Moskal <michal.moskal@gmail.com>
Thu, 28 Apr 2005 18:13:29 +0200


On 4/28/05, Jurek Bartuszek <koxta@koxta.net> wrote:
> Dnia 2005-04-28 17:47, U?ytkownik Michal Moskal napisa?:
> > How did you compile asm->dll?
>=20
> To .so:
>         1) nasm -f elf dodaj.asm -o dodaj.o
>         2. ld --shared --soname dodaj.so -o dodaj.so dodaj.o

You need to use this version on Linux.

> To .dll:
>         1) nasm -f coff dodaj.asm -o dodaj.o
>         2) /opt/xmingw/bin/i386-mingw32msvc-ld --shared -no-undefined
> - --export-all-symbols -o dodaj.dll dodaj.o

And this one won't work.

> A dll file created this way _does_ work when running myfile.exe on
> windows. On linux - it doesn't (well, I don't know this for real, cause
> I still can't force mono to search for his dlls in `pwd`)

Mono does not support native code DLLs from Windows when running on Linux.

I guess mono searches in the current directory. But failing to recognize
the file format, it says it cannot find (usable) DLL.

> > The file needs to be in the ELF format, linked as a shared library.
> So, are you trying to tell me, that it is impossible to use dll files
> with mono and DllImport?

Yes.

> > Specifically using dll from Windows won't work.
> I don't think I'm following you :-\ As far as I know, dll is a
> windows-specific format. Which dlls will work, then?

Only managed code (ones containing IL byte code, not native x86 machine
code) DLLs will work.


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