Version française
Home     About     Download     Resources     Contact us    
Browse thread
New C interfaces
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xleroy@p...>
Subject: Re: New C interfaces
> I have been reading the 1.04 documentation on the C language
> interface, and it occured to me that one could get library routined
> compiled with ocamlopt to live in harmony with the top level by
> compiling the library routines using ocamlopt -output-obj, and then
> linking them into the toplevel using -custom. It looks messy but
> practical.

It almost works, but not quite. One problem is that one would need a
runtime library that supports both the bytecode and the native-code
system. In particular, the garbage collector would need to scan both
the interpreter stack and the native stack.

> Does this make multiple copies of the garbage collector?

At any rate, the C linker will not let you do that (duplicate symbols
are an error in C). Also, if you had two GCs, it would be hard to pass
allocated data structures from one world to the other.

- Xavier Leroy