views:

243

answers:

1

Hi,

I've used mono mkbundle on cygwin, to compile a dot net app, and it works fine. I used the instructions from here http://stackoverflow.com/questions/1906843/c-cywgwin-mono-mkbundle-windows-7-cannot-compile-file

The finished app will not run unless the following files (copied from the mono/bin) folder are in the same folder as the app: mono.dll, libglib-2.0-0.dll, libgthread-2.0-0.dll, zlib.dll

This all seems ok - however if I run the command (from cygwin)

$ objdump -p mycompiledapp.exe | grep "DLL Name"
(where "mycompiledapp.exe" is the name of the app)

The files mono.dll, libglib-2.0-0.dll, libgthread-2.0-0.dll are already embedded in my app.

Why do these files need to be in the same folder as my app for it to function, when they are already embedded within my app?

Have I done something incorrect when compiling?

Is there any way to either:
a) Not embed these assemblies in my app (so they can be distributed with it)
b) Compile my app so it knows these assemblies are embedded in the app, and use those? (and not have to distribute these files with the app)

It just seems a pain to distribute these files with my app, when they are already embedded within it! (Especially considering the size of these assemblies - a 50k dot net app becomes around 5megs as a compiled mono-app, and this needs to be distributed with an additional 4 megs of assemblies for it to function...e)

Thank you for any info,

Smithy

+1  A: 

You can add the --static flag when running mkbundle. Note that this will embed the Mono library (mono.dll) which is LGPL. As for libglib and libgthread, you should find a static version of them and use that when linking. Note that embedding LGPL libraries in your program will have other implications.

Gonzalo
objdump says that mono.dll is already embedded in the app, even though it was compiled without the "--static" flag?
frank
It should be **referenced** from the generated exe, but not embedded. That's why you need mono.dll and the other DLLs to be available in your PATH or your current directory.
Gonzalo
According to the documentation, the --static flag is no supported on Windows.
ShdNx
@ShdNx: and Mono 2.8 and above do not depend on glib/gthread any more. This should not be a problem now.
Gonzalo