Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!uwm.edu!bbn.com!saustin From: saustin@bbn.com (Steve Austin) Newsgroups: comp.lang.c++ Subject: Re: porting C++ to tranputers Keywords: ports, transputers Message-ID: <59874@bbn.BBN.COM> Date: 8 Oct 90 15:02:12 GMT References: <1011@oscsunb.osc.edu> Sender: news@bbn.com Lines: 59 raghu@osc.edu (Raghu Machiraju) writes: >Has there been any attempt to port the AT&T translator to the transputer. >If anybody has done so or is aware of such an effort would he/she be kind >enough to share his/her experiences . More specifically I am interested in >using the Logical Sytems C compiler for the port . I haven't ported AT&T's translator to RUN on a transputer, but it is trivially easy to get C++ code compiled FOR a transputer - or anything else really - if you have a C compiler for the target machine. The program 'CC' is just a shell script which takes the C++ program, runs it through the pre-processor, runs the output of this through cfront and then compiles the resulting C code with the standard compiler. It is easy to divert the last step (compiling with the default cc) and then compile with the cross-compiler. If you don't want to mess around with the shell script environment variables, you can yse the -Fc switch to get C code produced from the standard output of CC, redirect this to a temporary file and compile this. I have also got this to work when the C++ and C compilers run on different machines by using some "rsh" hacks. There are some minor difficulies to be overcome. 1. "munch" may not work, since the nm command for the non-native code may not be compatible. I have avoided this by not using globals variables which have constructors. The action of munch is to construct a special function called _main(), which calls these constructors at the star of main(). 2. You have to write a dummy *C* _main() i.e. void _main() {} so that you don't get a complaint that the symbol _main is undefined when you link. 3. You have to write code for "operator new" and "operator delete" (in C++). I just wrote new as a wrapper for "malloc" and delete as a wrapper for "free". 4. Watch out for problems with include files. The only problem I had was that SUN's ctype.h seems to be different from anybody else's. This is a difference between the character table being defined as _ctype_ in on and __ctype in another (or something like that). However, your mileage may vary. Running CC on a SUN, I have done this successfully for the following processors. Transputer IBM RS6000 I860 Steve Austin P.S. No guarantees of accuracy here. I speak for myself, not my employer. P.P.S Yes, I know this is a hack - no flames please.