www.digitalmars.com         C & C++   DMDScript  

c++ - Couple of questions.

reply David <david_b barrysworld.com> writes:
Hi, forgive me if these questions are stupid but I'm new to this compiler.

First up, is there any way to dynamically link to crtdll.dll or msvcrt.dll 
instead of having it statically linked?  Well I think that's what's 
happening anyway. 

And second of all, what would be the switches to use to generate the 
smallest win32 .exe?  I've fiddled with a few but with no luck.

Thanks in advance,
David
Aug 19 2001
parent reply Jan Knepper <jan smartsoft.cc> writes:
David wrote:

 Hi, forgive me if these questions are stupid but I'm new to this compiler.

 First up, is there any way to dynamically link to crtdll.dll or msvcrt.dll
 instead of having it statically linked?  Well I think that's what's
 happening anyway.
sc -ND If I am correct. I think default is to link with the static libraries...
 And second of all, what would be the switches to use to generate the
 smallest win32 .exe?  I've fiddled with a few but with no luck.
sc -o+size Of course that also depends on whether or not you want to use the static or dynamic libraries... So try: sc -ND -o+size And see what happens. Jan
Aug 19 2001
parent reply David <david_b barrysworld.com> writes:
Jan Knepper <jan smartsoft.cc> wrote in
news:3B7FC241.54D9D68A smartsoft.cc: 

 David wrote:
 
 Hi, forgive me if these questions are stupid but I'm new to this
 compiler. 

 First up, is there any way to dynamically link to crtdll.dll or
 msvcrt.dll instead of having it statically linked?  Well I think
 that's what's happening anyway. 
sc -ND If I am correct. I think default is to link with the static libraries...
 And second of all, what would be the switches to use to generate the
 smallest win32 .exe?  I've fiddled with a few but with no luck. 
sc -o+size Of course that also depends on whether or not you want to use the static or dynamic libraries... So try: sc -ND -o+size And see what happens. Jan
Ok, I'm probably doing something incredibly stupid here, but here's what I get. C:\dm\bin>sc -o+size test.c Command line error: unrecognized parameter '+size'--- errorlevel 1 And if I use -ND I get: C:\dm\bin>sc -ND test.c link test,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved SND.lib Warning 2: File Not Found SND.lib OPTLINK : Warning 23: No Stack test.obj(test) Error 42: Symbol Undefined __acrtused_con test.obj(test) Error 42: Symbol Undefined _printf OPTLINK : Warning 134: No Start Address --- errorlevel 2 I don't have SND.lib, though I have snn.lib. Copying snn.lib to snd.lib just results in it compiling ok, but the same file size. I'm guessing the 'd' in snd.lib means dynamic, and I'm missing the lib. Was I meant to download anything else? Anyone care to mail it to me if it's not too much trouble? Or tell me where I can get it? Also -o+size doesn't seem to be working. This is 8.1c which I downloaded yesterday. Thanks for the help, David
Aug 19 2001
parent Jan Knepper <jan smartsoft.cc> writes:
David wrote:

 Ok, I'm probably doing something incredibly stupid here, but here's what I
 get.

 C:\dm\bin>sc -o+size test.c
 Command line error: unrecognized parameter '+size'--- errorlevel 1
Sorry... sc -o+space I usuall use -o+all <g>
 And if I use -ND I get:

 C:\dm\bin>sc -ND test.c
 link test,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 SND.lib
  Warning 2: File Not Found SND.lib
 OPTLINK : Warning 23: No Stack
 test.obj(test)
  Error 42: Symbol Undefined __acrtused_con
 test.obj(test)
  Error 42: Symbol Undefined _printf
 OPTLINK : Warning 134: No Start Address
I think this is indeed because you don't have the dynamic libraries (.LIB's or .DLL's) you would need. I do not think they are provided in the download... They are on the CD-ROM ($25+SH) though. Jan
Aug 19 2001