www.digitalmars.com         C & C++   DMDScript  

c++.command-line - Specifying libray search path to DMC with the -L option.

reply BK <bk767 yahoo.com> writes:
First off, let me say thank you for this great product.

The -L option seems to be serving several overlapping purposes. The
documentation states:

*	-Llinker Use linker linker instead of default.
This is useful if a special linker is being used, or if the linker
is not on the PATH or in the directory where dmc resides.  For
example, -L\path\mylink tells the compiler to run the MYLINK
linker in the \path directory.

*	-L/switch Pass /switch to linker.
For example, this command:

dmc test -L/packcode -L\test\prog 

adds the option /packcode and the library search path \test\prog
to the linker's command line.

In the second form of that last example, the \test\prog is being
interpreted as a replacement linker, which obviously does not
exist..it's a directory where libraries are located.  Replacing it
with its absolute path doesn't help.  Clearly, the -L cannot serve two
different purposes with the same syntax:

set PATH=c:\bin\dm\bin;%PATH%
dmc -cpp -Aa -Ab -Ae -Ar -Aw -w3 -Ic:\bin\dm\stlport\stlport (continued..)
-I\test\prog -L\test\prog foo.c util.lib

\test\prog foo,,,util+user32+kernel32/noi;
Can't run '\test\prog', check PATH		

So my question is: what is the proper way of adding a library search
path?  I know about modifying the LIB environment variable, but that's
infeasible.  Obviously, I'm misunderstanding something as this is a
no-brainer for any other compiler.  Thanks.
Nov 14 2005
parent reply Derek Parnell <derek psych.ward> writes:
On Mon, 14 Nov 2005 10:00:34 +0000 (UTC), BK wrote:

 First off, let me say thank you for this great product.
 
 The -L option seems to be serving several overlapping purposes. The
 documentation states:
 
 *	-Llinker Use linker linker instead of default.
 This is useful if a special linker is being used, or if the linker
 is not on the PATH or in the directory where dmc resides.  For
 example, -L\path\mylink tells the compiler to run the MYLINK
 linker in the \path directory.
 
 *	-L/switch Pass /switch to linker.
 For example, this command:
 
 dmc test -L/packcode -L\test\prog 
 
 adds the option /packcode and the library search path \test\prog
 to the linker's command line.
 
 In the second form of that last example, the \test\prog is being
 interpreted as a replacement linker, which obviously does not
 exist..it's a directory where libraries are located.  Replacing it
 with its absolute path doesn't help.  Clearly, the -L cannot serve two
 different purposes with the same syntax:
 
 set PATH=c:\bin\dm\bin;%PATH%
 dmc -cpp -Aa -Ab -Ae -Ar -Aw -w3 -Ic:\bin\dm\stlport\stlport (continued..)
 -I\test\prog -L\test\prog foo.c util.lib
 
 \test\prog foo,,,util+user32+kernel32/noi;
 Can't run '\test\prog', check PATH		
 
 So my question is: what is the proper way of adding a library search
 path?  I know about modifying the LIB environment variable, but that's
 infeasible.  Obviously, I'm misunderstanding something as this is a
 no-brainer for any other compiler.  Thanks.

The OptLink program does not have a switch that can be used to pass a library path to it. It only accepts library paths from the LIB environment symbol, the command line, and a 'response' file. But if you are invoking the linker from DMC then you have no control over these methods. The only convenient way is to modify the sc.ini file that resides in the same directory as dmc.exe. In that file you should see a LIB= line. Append the path to library on to this line. e.g. LIB=LIB=c:\dm\lib;e:\mylibs\special Also be sure to change the attributes of the sc.ini file to read-only because each new install of DMC will otherwise replace your updated sc.ini with the default one. But even then, you still have to unzip the files one-by-one so the ZIP program doesn't accidentally destroy your updates to sc.ini. This is not a brilliant solution but its the only one that Walter advocates. He's not going to change OptLink to be more useful. -- Derek (skype: derek.j.parnell) Melbourne, Australia 15/11/2005 10:05:22 AM
Nov 14 2005
parent reply BK <bk767 yahoo.com> writes:
In article <1vszg0zyd4gb6$.sf9omivzndad$.dlg 40tude.net>, Derek Parnell says...
The OptLink program does not have a switch that can be used to pass a
library path to it. It only accepts library paths from the LIB environment
symbol, the command line, and a 'response' file. But if you are invoking

Can you give an example of this?
Nov 17 2005
parent reply BK <bk767 yahoo.com> writes:
In article <dljhhv$6u4$1 digitaldaemon.com>, BK says...
In article <1vszg0zyd4gb6$.sf9omivzndad$.dlg 40tude.net>, Derek Parnell says...
The OptLink program does not have a switch that can be used to pass a
library path to it. It only accepts library paths from the LIB environment
symbol, the command line, and a 'response' file. But if you are invoking


It appears the posting software removed initial spaces from my previous message. What I meant was can you give an example of it accepting library paths from the command line. Thank you.
Nov 17 2005
parent Scott Michel <scottm aero.org> writes:
BK wrote:
 In article <dljhhv$6u4$1 digitaldaemon.com>, BK says...
 
In article <1vszg0zyd4gb6$.sf9omivzndad$.dlg 40tude.net>, Derek Parnell says...

The OptLink program does not have a switch that can be used to pass a
library path to it. It only accepts library paths from the LIB environment
symbol, the command line, and a 'response' file. But if you are invoking


It appears the posting software removed initial spaces from my previous message. What I meant was can you give an example of it accepting library paths from the command line. Thank you.

link <link flags> <objects>,<exename>,<mapfile>,lib1 lib2 \my\lib\path\ lib3 lib4 lib5,<def file>,<res file> Just put the directory name in the list of libraries.
Nov 17 2005