Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using backticks to access MSDos (on winnt) to call the Visual C++ compiler. Something like $msg=`cl -c myprog.c`. This fails with message : Program too big to fit in memory. If I do my command directly on MSDos command line it works fine. I have tried everything under the sun to fix this. ( I do the call from perl because it is easiest to construct the compiler switches etc using perl ). Any help or ideas would be hugely appreciated ...

Replies are listed 'Best First'.
Re: memory restiction ?
by chromatic (Archbishop) on Mar 17, 2000 at 22:16 UTC
    Hmm, using backticks will grab all error messages from the child process. Why not use system and redirect output from the compiler to a temporary file (within the string passed to system)? If there are errors returned, display the temporary file with Perl.
RE: memory restiction ?
by ender (Novice) on Mar 17, 2000 at 22:15 UTC
    I'm not sure you're using perl for the right reasons here. It sounds like what you're looking for is a Makefile? You want to build a lot of stuff given different compiler options?
Re: memory restriction ?
by turnstep (Parson) on Mar 25, 2000 at 00:07 UTC
    Tough one. MSDOS is a pain. Have you tried allocating more memory for the DOS box? Worse case scenario, you could have perl write a batch file (cl -c myprog.c > tmpfile) and run that in a separate window, then run your program on the results. Of course, you could do that all in the same window with an ugly batch file:
    @ECHO OFF perl foobar.pl makebat ## creates TMP.BAT (the compiler) TMP.BAT ## writes it's output to TMP.TXT perl foobar.pl readresults
    Bleh. Better to just mess with the memory. You might also see if there is anyway you can get C++ to be more "memory friendly"