www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Question about libraries

reply Ary Manzana <ary esperanto.org.ar> writes:
Hello.

First of all, this question has nothing to do with DFL.

When I compile a program with DFL (i.e. "dfl program.d ..."), it 
translates the command to "dmd.exe ..." with some extra parameters. One 
of those parameters is

-L/exet:nt/su:windows:4.0 C:\ary\PROGRA~1\d\dmd\lib\DFL_DE~1.LIB

What is the meaning of that?

I'm asking this question because we'll make Descent configurable for 
building projects, and for that a user should specify include paths, 
libraries, and some flags. But, I don't understand how the -L switch 
works. The documentation just says:

-Llinkerflag
     pass linkerflag to the linker, for example, /ma/li


Another question: are include paths and libraries enough for compiling a 
file and linking everything, or am I missing something?

Thanks,
Ary
May 30 2007
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Ary Manzana" <ary esperanto.org.ar> wrote in message 
news:f3il6s$k9k$1 digitalmars.com...
 -L/exet:nt/su:windows:4.0 C:\ary\PROGRA~1\d\dmd\lib\DFL_DE~1.LIB

 What is the meaning of that?

 I'm asking this question because we'll make Descent configurable for 
 building projects, and for that a user should specify include paths, 
 libraries, and some flags. But, I don't understand how the -L switch 
 works. The documentation just says:

 -Llinkerflag
     pass linkerflag to the linker, for example, /ma/li
It passes everything that followss (up to a space, perhaps) to the linker, so you have to look at the linker's usage to find out what all those flags do. In this case, /exet:nt means "EXEType: Windows NT" (i.e. XP), /su:windows:4.0 means "SUbsystem: Windows 4.0" (i.e. XP again, unless someone really pedantic wants to tell me otherwise). So it's telling the linker we want to make a Windows executable. This will prevent any command prompt from flashing up when your EXE starts, or something like that.
May 29 2007
parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Jarrett Billingsley wrote:
 In this case, /exet:nt means "EXEType: Windows NT" (i.e. XP), 
 /su:windows:4.0 means "SUbsystem: Windows 4.0" (i.e. XP again, unless 
 someone really pedantic wants to tell me otherwise).
You called? :) Windows NT 4.0 was just that, Windows NT 4.0. Windows NT 5.0 was marketed under the name Windows 2000. Windows NT 5.1 was named Windows XP. Vista is the marketing name for NT 6.0. NT 4.0 executables should work on all of the above though.
 So it's telling the 
 linker we want to make a Windows executable.  This will prevent any command 
 prompt from flashing up when your EXE starts, or something like that. 
Actually, it shouldn't "flash up". It'd be visible the entire time the program was running (unless perhaps it makes some obscure API call to get rid of it). Console windows "flashing up" is more typical for console applications not started from the console; the application often terminates quickly when no command-line parameters are given, causing the console to almost immediately disappear again.
May 30 2007
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Frits van Bommel" <fvbommel REMwOVExCAPSs.nl> wrote in message 
news:f3jos4$2a4h$1 digitalmars.com...
 You called? :)

 Windows NT 4.0 was just that, Windows NT 4.0.
 Windows NT 5.0 was marketed under the name Windows 2000.
 Windows NT 5.1 was named Windows XP.
 Vista is the marketing name for NT 6.0.

 NT 4.0 executables should work on all of the above though.
Why thank you :)
May 30 2007
prev sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Ary Manzana wrote:
 Hello.
 
 First of all, this question has nothing to do with DFL.
 
 When I compile a program with DFL (i.e. "dfl program.d ..."), it 
 translates the command to "dmd.exe ..." with some extra parameters. One 
 of those parameters is
 
 -L/exet:nt/su:windows:4.0 C:\ary\PROGRA~1\d\dmd\lib\DFL_DE~1.LIB
 
 What is the meaning of that?
Like you say below, the -L stuff is passed to the linker, so you should be able to check the linker docs for what all that means. The linker help says the following: C:\> link -h ... EXET[ype] SU[bsystem] ... Granted that's not very informative, but it's saying that the program should be linked as an 'nt' type executable with the 'windows' version '4.0' subsystem. The only thing I think you really need to give users the option of changing there is the 'windows' part. For a console app you need to change that to 'console'. The part after that is just a library to link to, so I assume you know what that's for.
 I'm asking this question because we'll make Descent configurable for 
 building projects, and for that a user should specify include paths, 
 libraries, and some flags. But, I don't understand how the -L switch 
 works. The documentation just says:
 
 -Llinkerflag
     pass linkerflag to the linker, for example, /ma/li
Yeh, it just means dmd -L/ma/li will call the linker like link.exe /ma/li
 Another question: are include paths and libraries enough for compiling a 
 file and linking everything, or am I missing something?
I think so. sc.ini has a DFLAGS and a LINKCMD variable so I guess those are necessary too. But if you're invoking dmd, then presumably you'll be getting that already. --bb
May 29 2007