From: khan AT xraylith DOT wisc DOT edu (Mumit Khan) Newsgroups: comp.os.msdos.djgpp Subject: Re: -frepo flag, is it supported? Date: 18 Oct 1998 07:01:58 GMT Organization: Center for X-ray Lithography, UW-Madison Lines: 38 Message-ID: <70c3p6$1r02$1@news.doit.wisc.edu> References: <000b01bdf929$2688b230$6dd22b0f AT ros51675cra DOT rose DOT hp DOT com> NNTP-Posting-Host: modi.xraylith.wisc.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <000b01bdf929$2688b230$6dd22b0f AT ros51675cra DOT rose DOT hp DOT com>, Andrew Crabtree wrote: > > >G.J. de Vries wrote in message ><1 DOT 5 DOT 4 DOT 32 DOT 19981016122919 DOT 0066bf88 AT mail DOT euronet DOT nl>... >> Hi, >> >> I have a single question about DJGPP: does it support the -frepo flag. >I don't think it works correctly without collect2. I made a couple of goes >at porting collect2 over but never got it working properly. Collect2 relies >heavily on fork, and the djgpp fork does not work (mainly because does >doesn't multitask). > Actually, the fork() is used to simply redirect the child program's (ld, nm etc) stdout and stderr, so it should be pretty easy to make collect2 work under djgpp. I remember doing this for mingw32, and it was quite simple. Unfortunately, it was quite messy for mingw32 and I decided to retract my patch to discourage folks from using it (you should never need to use -frepo hack at least on ELF and PE-COFF). There are two ways: - use a temporary file. Write a popen like replacement that redirects both stdout and stderr. I believe the djgpp's popen already uses temp files, so it's already there in source form to reuse. Modify collect_execute (or is it fork_execute?) to do the right thing. - dup/save the parent's stdout/err, spawn the child with the new descriptors for stdout/err, restore parent's stdout/err and read from the child's stdout/err. This is what I did for mingw32 if I remember correctly. It should be somewhere on egcs mailing lists (before the lists were split). Regards, Mumit