LIB flag on Windows DMD (nagging)

Robert Jacques sandford at jhu.edu
Tue Mar 30 07:23:52 PDT 2010


On Tue, 30 Mar 2010 06:31:44 -0300, Bane  
<branimir.milosavljevic at 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:\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.

I don't know about the general case, but I use pragma(lib,...) with a  
library in my working directory and it works.



More information about the Digitalmars-d mailing list