Create D portable binary

Adam D. Ruppe destructionator at gmail.com
Fri Dec 8 06:37:36 UTC 2017


On Friday, 8 December 2017 at 05:16:22 UTC, Fra Mecca wrote:
> Is there a way to compile a project and deploying it as a 
> single statically linked binary?

A default build of a D program is *reasonably* compatible. All 
its dependencies are core operating system components like libc. 
Now, there can certainly be libc version incompatibilities, but 
there's a decent chance it will just work.

I'm pretty sure this is the exact same situation Go is in; the 
default Go and D builds link the same way.


If you want to eliminate the potential C lib incompatibility too, 
you can do it basically the same way as in C, passing options to 
gcc with dmd's -L thing like `-L-static -L-nodefaultlib 
-L-lsome_alternate_clib`


More information about the Digitalmars-d-learn mailing list