Hi! 3-Фев-2004 19:46 [EMAIL PROTECTED] (Bart Oldeman) wrote to [EMAIL PROTECTED]:
>> - with BCC defaults for options may be written in turboc.cfg. How to reduce >> command line in Watcom? Where (in which .ihp file) this explained (if this BO> environment variables or @file BTW, Watcom doesn't searches @file in PATH. Inconsistent. B-\ Also, there is no implicit config file, whereas @file eats space on command line. BO> optimization effects. Look for instance at "Describing how functions use BO> memory". Of course, I will read this chapter carefully when will study pragma-assembler. >> - with BC stack size may be defined (in source!) by next definition: >> extern unsigned _Cdecl _stklen = ...; >> How do this in Watcom? Which default stack size in Watcom (and where this >> explained)? BO> There is the option stack=nnnn for the linker. Note that memory is BO> organized differently; IIRC in small model for Turbo C you have (for the BO> data segment): BO> data - BSS - heap - stack BO> whereas for Watcom it's BO> data - BSS - stack - heap BO> so you cannot dynamically change the stack size. I not say about dynamic stack change, I mean default stack size. Unfortunately, Watcom startup uses (undocumented) _stacklen only for tiny model (for .COM files), else there defined stack segment with 2k size. (As I understand, wlink simply redefines those stack segment). BO> default is stack size = 4096 (see the map file) 2k (db 800h in cstrt086.asm), not 4k. >> - how to compile .COM files? With command line >> wlink form dos com file attrib.obj >> wlink gives some errors about "segment relocation", then "stack segment BO> In your example there must be something in the object that causes a BO> segment relocation. No, there are no (extra) relocations. Bug is in wlink itself, because with "sys com" (and wlink.lnk in PATH) there are no relocations, nor page faults. >> - BCC generates 9148 bytes of ATTRIB.COM (7306 with redifinition for some >> RTL functions), Watcom generates 10296 bytes of ATTRIB.EXE (with WPP >> options -ms-ox). How I may reduce size of executables? BO> -ox isn't the best for codesize. It does -obmiler -s; wpp does -obmilr -s. Yes, I already notice difference in explanations for -ox in different places (in help files in help screens). BO> Anyway, -os -s or -oas -s or -oals -s will generally be smaller. Looks like best (default) should be -obhklrs and sometime with -oami[+]-s? Anyway, ATTRIB.OBJ for -obhklrs-oami+-s (almost) identical to result with -oxshki+-s. BO> Also watcom's printf is fairly large since it deals with 64-bit integers BO> (long long) and wide characters. Have a look at the map file; Hm. ______________O\_/_________________________________\_/O______________ #include <stdio.h> int main () { puts ("Hello, world!"); return 0; } _____________________________________________________________________ O/~\ /~\O (Note: Watcom also doesn't allows to use `int main' without `return 0'). Results of compilation for BC (B) and Watcom (W), with puts (1) and printf (2), in small (S) and tiny (T) models: puts() 1sb.exe 5148 1tb.com 4564 1sw.exe 4758 1tw.com 4582 printf() 2sb.exe 6654 2tb.com 6070 2sw.exe 8710 2tw.com 8534 Yes, BC lose for puts() in executable (too big header), but wins in .COM. With printf() gap is increased. :( BO> perhaps you can replace a few functions by stubs. May you offer some ready stubs? BO> Replacing printf, malloc and free, BTW, ATTRIB doesn't uses printf() at all. malloc() is also doesn't used, but .map shows that it (along with realloc()) there. :( BO> and getenv (as is done in SYS; Ok, I look there. BO> getcmd() instead of main(argc, argv) can also reduce the size -- but it BO> means you have to reorganize your option processing. Yes, this is inacceptable (for portability). BO> the *o* libaries deal with overlays. Aha! One more meg may be removed. BO> The normal way to use the openwatcom people is through the news server BO> (NNTP: news.openwatcom.org, groups openwatcom.users.c_cpp and BO> openwatcom.contributors). Not sure if you can reach that, there may be BO> mail-to-news gateways but I don't know. There's also a bugzilla just like BO> for freedos. mail2news? Inconvenient. :( PS: Is there option, which equal to "#pragma on (reuse_duplicate_strings)"? ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Freedos-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-devel