DUB specify version identifier on command line?

XavierAP via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 7 14:30:30 PST 2017


I'm talking about the conditional compilation keyword "version", 
not about version strings. I've looked in DUB's help and 
reference [1][2] but can't seem to find how to solve my problem. 
On the command line it seems to be possible to specify debug 
identifiers, but not version identifiers. [3]

It came up while trying to do something specific, so I'll explain 
this. I'm learning and trying things, and I was playing with 
dlib.core.memory. Before moving to the next thing I wanted to try 
printMemoryLog(). This outputs memory debugging info, only when 
compiled with version(MemoryDebug) [3].

I'm working with Visual D. However for 3rd party package 
dependencies it's simpler to compile them with dub, and have VS 
find the lib for my client project. Without the version 
identifier, my program works: compiles, links to dlib, and runs 
ok. Then I instruct VS to define version(MemoryDebug) for some 
configuration. No matter how I re-run dub to build dlib, I get 
linking errors from the additional functions defined in the 
imported dlib source which aren't found in the binary lib.

I guess it's also possible to specify this by adding to the 
dub.json file [2], but for me it's more flexible if I can leave 
it alone and compile different versions from the command line 
alone. But if the json is the only way please let me know. 
Otherwise what am I missing? Thanks in advance.


[1] http://code.dlang.org/docs/commandline#build
[2] http://code.dlang.org/package-format?lang=json#version-specs
[3] https://dlang.org/spec/version.html#DebugCondition
[4] 
https://github.com/gecko0307/dlib/blob/master/dlib/core/memory.d


More information about the Digitalmars-d-learn mailing list