How do I statically build a project using DUB?

Ferhat Kurtulmuş aferust at gmail.com
Sat Aug 29 14:34:23 UTC 2020


On Saturday, 29 August 2020 at 11:27:28 UTC, Kirill wrote:
> I need a stand-alone executable that does not require the user 
> to install any libraries on their computer. Everything should 
> be packed into the executable.
>
> I understand that I need to statically link all of the 
> libraries I use in my project, but how do I do this? What do I 
> need to add to dub.json file? What compiler flags do I need to 
> use?
>
> Thanks in advance.

In dub.json:

"libs": ["exlib1", "exlib2"],

For any libexlib1.a or exlib2.lib, omit the extensions.

You can also do it like:
"lflags": ["-lstdc++"],



More information about the Digitalmars-d-learn mailing list