Compiling an app to a single binary - possible?

QAston qaston at gmail.com
Fri Nov 15 07:40:16 PST 2013


On Friday, 15 November 2013 at 15:27:45 UTC, Jacek Furmankiewicz 
wrote:
> One of the nice features of Go is that when you compile an app, 
> it pulls in ALL the dependencies (i.e. the full SDK + all 
> libraries your app depends on) and generates a single binary 
> (around 2 MB for a Hello World app).
>
> This is extremely useful for deployment purposes, since it is 
> so straightforward to just copy the app to multiple servers 
> without having to worry if every one of them has all the 
> required dependencies installed / updated, etc.
>
> Does D offer something similar (maybe via some dmd switches)?
>
> For example, If I am creating a vibe.d app, would I need to 
> deploy the vibe.d libraries separately with my app on all the 
> servers in production?
>
> Thanks
> Jacek

D, like many languages compiled to native code (C, C++) supports 
dynamically loaded libraries (.dll and .so files) as an option. 
You have an option to use DLLs (in which case you'll have to 
deploy them) but it's not a requirement - you can build just like 
in Go as long as you don't use the DDL feature.

You should check vibe.d build options whenever it's possible to 
build it without DLL dependency.


More information about the Digitalmars-d-learn mailing list