thomas@duteca (Thomas Okken) (02/28/91)
I am working on a port of Rayshade 4.0, a freeware ray-tracer for unix from Craig Kolb of Yale. This program requires use of the C preprocessor (cpp) to process its input files, before rayshade itself starts using them. The original, running on unix, can simply start cpp as a second process and pipe the input file through it. Under MPW, the same result is achieved by constructing the pipe explicitly from the command line (or a script): C -e inputfile | rayshade > outputfile Or, using the GNU cpp: cpp inputfile | rayshade > outputfile This is all very nice for MPW users, but since my vanity requires that all Mac II users be able to use this port, I need to make a stand-alone application. At first, I thought this would be simple: rename main() to main_cpp() in the cpp source (using the sources for GNU cpp that I ftp-d from apple.com), rename main() in rayshade to main-rayshade(), and calling them from the code that handles the Mac front-end. Before calling main_cpp() and main_rayshade(), I would set up appropriate argc and argv variables, and redirect stdin, stdout and stderr using freopen(). But now a problem arises: how do I link all this? How do I prevent the MPW linker from throwing out routines and globals that happen to have the same name in both programs? If I can't figure this one out, I'm afraid I'd have to rename all duplicated functions, probably using some sed or awk script, but given the amount of sources involved, this seems like a *big* task. So, if anyone out there knows an easy solution to this problem, possibly through experience with program-merging jobs like this, I would be delighted to hear about them! And, of course, if anything useful comes up, I will summarize to the net. - Thomas (thomas@duteca.et.tudelft.nl)