[C--] Callbacks tempt me to write a run-time system in C--.

Hendrik Boom <[email protected]> Sat, 23 Mar 2013 20:07:25 +0000 (UTC)
Newsgroups gmane.comp.lang.c--
Message-ID <[email protected]>
Let's say I write a piece of runtime system in C.

It's not hard to call runtime routines from C--.

In my case it's some of the I/O system of Algol 68, but I'm sure more 
complicated cases exist.

The write routine takes a moderately complicated data structure, easily 
mapped using C structures and casts.

But that data structure contains Algol 68 procedures, which, of course, 
get called using C-- calling  conventions.

Somehow the runtime system has to know how to call these.

One way out is to make every Algol 68 procedure use C calling 
conventions, which, admittedly, isn't quite as bad as generating C object 
code.

The other way if for the run-time system to be at least partially written 
in C--.

I can see the use of a systems C--.

Without having a systems C--, I might be able to jigger my code generator 
to generate one of these reverse shims for every type of procedure that 
might be called from the run-time system.  This would require the 
compiler to be aware of potentially useful libraries, and there are a lot 
of them nowadays that use callbacks.

Any other ideas on how to call C-- procedures from C?

-- hendrik



_______________________________________________
Cminusminus mailing list
[email protected]
https://lists.eecs.harvard.edu/mailman/listinfo/cminusminus