Static linking of Cobra applications
Posted: Thu Dec 16, 2010 3:06 pm
I already answered my own question, but the answer might be interesting for someone else.
Static linking is possible with mono. Use the following command to create a native executable without mono dependencies. Alternatively you can also bundle all libraries and only have a dependency on mono.
This seems only useful if you want to execute your Cobra code on a machine without mono. Start up time is a lot slower compared with running the exe in mono. Compressing the binaries helps with the file size (~40% reduction in my limited test), but worsens start up time further.
Static linking is possible with mono. Use the following command to create a native executable without mono dependencies. Alternatively you can also bundle all libraries and only have a dependency on mono.
- Code: Select all
$ mkbundle --deps --static fib.exe -o fib-static # fully static - runs on computers without mono
$ mkbundle --deps fib.exe -o fib-bundle # bundle - runs on computers with mono, but without Cobra
$ ls -hs fib-* # however: ouch
6,3M fib-bundle 9,2M fib-static
This seems only useful if you want to execute your Cobra code on a machine without mono. Start up time is a lot slower compared with running the exe in mono. Compressing the binaries helps with the file size (~40% reduction in my limited test), but worsens start up time further.