Date: Sun, 9 Mar 1997 18:16:32 +0200 (IST) From: Eli Zaretskii To: John Schucker cc: djgpp AT delorie DOT com Subject: Re: Compiling old source. In-Reply-To: <5fran9$4ja$1@news3.alpha.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 8 Mar 1997, John Schucker wrote: > I was wondering if anybody could offer me an easy way to get old source > to compile, say the source in man_pc.zip? > > Just as an example, take man, which if memory serves is composed of man.c > and man.h. It compiles, I think it dies on linking because it has all > sorts of references to the old go32 stuff. There's no general way to overcome such problems, sorry. I suggest you try to track down the problems that gcc is complaining about (the messages are usually quite self-explanatory, and include pointers to the places in the source where things don't work). For those cases where you can't figure out what's the problem, or how to correct it, post here the relevant info (the message(s) printed by gcc and the source fragments where applicable) and you will get specific help. > Also, is there any way to figure out how much memory a process uses, > E.G., when I run gcc? No general solution to this either. For gcc, add -dm option to the command line, and the compiler will print its memory usage for data only, it doesn't include the code size. (It will attempt to call a program named `ps' which on Unix displays CPU time usage; you can disregard the error message printed because there's no `ps' on MSDOS.) If you also want this kind of statistics from the linker, add -Wl,--stats to the gcc command line. Other utilities may or may not support similar functionality. For example, GDB has the --statistics option which causes it to report memory and CPU usage after every command. If a program lets you shell out to DOS, you can run a memory-reporting utility (such as `mapmem' or `mem /c' from DOS) to track the extended memory left free. If you run Make, just add a call to such a memory-reporting program in all the rules that you care about. For programs that you write, a call like "sbrk (0)" will return the largest memory address mapped into your program; calling that in different places and printing the differences will show you how the program gobbles memory. Since in DJGPP the memory is never returned to the DPMI host until the program exits, you can just call `sbrk' once at the beginning and once before exit and use the difference as the memory usage estimate. Of course, if you run from Windows, you can use any of the programs that report resource usage (assuming no other programs run together with your DJGPP program).