digitalmars.D - LIB flag on Windows DMD (nagging)
- Bane (22/28) Mar 30 2010 (Disclaimer: I don't know is this solved on dmd later than 1.030, I'm st...
- Robert Jacques (4/41) Mar 30 2010 I don't know about the general case, but I use pragma(lib,...) with a
- Bane (2/4) Mar 30 2010 That works by default. Problem is when different projects share same lib...
- Walter Bright (4/13) Mar 30 2010 The reason this is not the default, and why sc.ini overrides the environ...
(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:\xxx2. dmd ... -Lsome_flag_to_optlinkwon't work3. set LIB=c:\xxx dmd ...won't work (I haven't found in optlink docs that you can pass argument for lib path)4. bud ... -LIBPATH=c:\xxx ...won't work (sc.ini in dmd binary folder rewrites LIB env. var with the one in it)4. edit sc.ini in dmd folder and add c:\xxxwont work (same as 3)5. create sc.ini in project folder and add c:\xxx to LIB env varnot smart (not all projects need that lib path, even worse if different projects use 2 distinct mylib.lib)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.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)
Mar 30 2010
On Tue, 30 Mar 2010 06:31:44 -0300, Bane <branimir.milosavljevic gmail.com> wrote:(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:\xxxI don't know about the general case, but I use pragma(lib,...) with a library in my working directory and it works.2. dmd ... -Lsome_flag_to_optlinkwon't work3. 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 ...won't work (I haven't found in optlink docs that you can pass argument for lib path)4. edit sc.ini in dmd folder and add c:\xxxwont work (same as 3)5. create sc.ini in project folder and add c:\xxx to LIB env varnot smart (not all projects need that lib path, even worse if different projects use 2 distinct mylib.lib)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.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)
Mar 30 2010
Robert Jacques Wrote:I don't know about the general case, but I use pragma(lib,...) with a library in my working directory and it works.That works by default. Problem is when different projects share same libs from some other folder.
Mar 30 2010
Bane wrote: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.The reason this is not the default, and why sc.ini overrides the environment, is because changing the environment for each compiler is tedious and error prone. dmd is designed to default to be independent of the environment for that reason.
Mar 30 2010