How to build a static lib properly?
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Mon Mar 6 03:07:56 UTC 2023
On 06/03/2023 3:49 PM, ryuukk_ wrote:
> On Monday, 6 March 2023 at 01:57:21 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
>> On 06/03/2023 2:52 PM, ryuukk_ wrote:
>>> Are you saying dub doesn't build a static dcd.lib?
>>
>> It did, but it doesn't contain any of the dependencies.
>>
>>> What to do to make it so i get a static dcd.lib file that contains
>>> all the code it needs?
>>
>> $ dub build --combined
>>
>> That may work. No guarantees. Dub isn't setup for distribution like this.
>
> combined didn't work, i still get a bunch of unresolved symbols
> (although less long):
>
> https://gist.github.com/ryuukk/d59eb89979f1666139ffe0ac95307f20
I've got it to work via:
$ cd DCD
$ dub build --build-mode=allAtOnce --combined
$ cd ..
$ ldc2 app.d DCD/dcd.lib
```d
void main(string[] args)
{
init_dcd();
}
extern(C) void init_dcd() {}
```
ldc2 on Windows.
DCD/dcd.lib should be about 23mb.
I did have to hunt some files down, it seems some build commands in DCD
isn't setup for this (almost certainly not using the environment
variables that dub offers to handle this situation).
More information about the Digitalmars-d-learn
mailing list