This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Code or documentation to the C run-time


"His Holiness the Reverend Doktor Xenophon Fenderson, the Carbon(d)ated"
wrote:
> 
> Hello all,
> 
> I'm looking for any information (and/or source code) to the C run-time
> system.  I'm pretty certain I can figure out glibc once I figure out
> where to look, but pointers to descriptions of other systems
> (e.g. 4.3BSD) would be helpful, and pointers to specific sources would
> be even more useful.
If you stick to a Unix lowest common denomenator, instead of writing to
glibc, it will be much more portable. I would look on source CD's for
the system libc code - Debian and OpenBSD binary and source CD's can be
picked up for 10 bucks at Cheapbytes.

>  If anyone has any information about other
> language run-times, or any information about how the various language
> run-times interact (e.g. FORTRAN and C, Java and C), I'd love to hear
> about it.
Everything uses C calling semantics. Java uses C++ calling conventions
for objects (cf. gcj documentations, especially the Cygnus Native
Interface), and Ada can, if the right pragmas are set (cf. the GNAT
users guide and reference manual). FORTRAN and C have virtually no
run-times to worry about on a Unix system. Java uses the Boehm GC, which
works in an enviroment without global GC. Ada requires that if you use
an Ada function with a non-Ada main program, you call _ada_init before
and _ada_final (or something like that). If this was a little vague,
it's because the question was a little general.

> a run-time system and standard library, 
Isn't that specified by the standard?

> how I'm going to interface Lisp with C
Use C calling conventions and provide a header translating Lisp data
types to C.

> (because the compiler itself will be written partially in
> Lisp, so I don't have to bother recreating half of the Lisp run-time
> system anyway)
Don't. Really. GNAT is the least portable and the largest pain to port
(ignoring the Modula-3 compiler, which suffers from the same problems),
just because it's writting in non-C. For it to work as a component of
GCC best, it should be written in the same K&R/ANSI C as GCC, or at
least GNU C, like G77. 

> What I'd like to end up with is the ability to compile Lisp source
> code (with a batch compiler similar to cc(1)) into C-like .o files,
> and then link those into a C (or FORTRAN, or Pascal, or whatever)
> program in the usual way.  
Good luck. That's the Right Way, but not the easy way.

> I'm hoping that this can be done without
> any modifications to GCC or binutils.  (Modifying vendors' tools is
> sort of out of the question either way, eh?)
Realize that if you need extensions to GCC, that they can be made,
provided they're well thought out.
> 
> And no, I don't know what I'm doing.  If I did, it's highly unlikely
> that I would be attempting this.  :)
I agree :->


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]