LIB flag on Windows DMD (nagging)

Bane branimir.milosavljevic at gmail.com
Tue Mar 30 02:31:44 PDT 2010


(Disclaimer: I don't know is this solved on dmd later than 1.030, I'm stuck with it past...)

Problem: PITA when using DMD on windows with custom library paths

Example: there is pragma(lib, "mylib.lib"); somewhere in the code. mylib.lib is not on the known path for the compiler (lets say c:\xxx). How to tell dmd where to look for it?


1.
dmd ... -Ic:\xxx
>> won't work

2.
dmd ... -Lsome_flag_to_optlink
>> won't work (I haven't found in optlink docs that you can pass argument for lib path)

3.
set LIB=c:\xxx
dmd ...
 >>  won't work (sc.ini in dmd binary folder rewrites LIB env. var with the one in it)

4.
bud ... -LIBPATH=c:\xxx ...
>> wont work (same as 3)

4.
edit sc.ini in dmd folder and add c:\xxx
>> not smart (not all projects need that lib path, even worse if different projects use 2 distinct mylib.lib)

5.
create sc.ini in project folder and add c:\xxx to LIB env var
>> pain in the royal behind (lot of duplication, as original LIB, DFLAGS and LINKCMD are not changed, also, full path to dmd folder must be supplied as %@P% points to project folder now)


Is there a way to remedy it?
Or just to edit line in original sc.ini in dmd folder from

 LIB="%@P%\..\lib";\dm\lib

to

 LIB="%@P%\..\lib";\dm\lib;%LIB%

it seems that adding %LIB% at the end apends existing LIB env var, so paths are preserved.



More information about the Digitalmars-d mailing list