dynamic linker flags with dub

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Apr 29 22:25:19 UTC 2024


On 30/04/2024 10:20 AM, KytoDragon wrote:
> I want to use dll-style hot-reloading for a windows application which 
> requires a different name for the PDB file for each compilation. 
> (windows locks the pdb file when loading the dll and the compiler can't 
> create a new pdb with the same name). How can I achieve this with dub? 
> Is there a way to inject variables into the linker flags?
> 
> E.g. something like this in the dub.json:
> 
> "lflags-windows-ldc": ["/PDB:foo_%random%.pdb"]

Your best bet probably is to use dub as a library, and change your 
``targetName`` or ``targetPath`` on each compilation.

Alternatively you could generate your dub file with the change in it 
each time that depends upon the actual library (which would be a 
``sourceLibrary``).


More information about the Digitalmars-d-learn mailing list