caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Annoying compiler magic
@ 2005-11-12 22:00 Jonathan Roewen
  2005-11-12 22:24 ` Eric Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Roewen @ 2005-11-12 22:00 UTC (permalink / raw)
  To: caml-list

Hi,

I'm trying to make a custom stdlib.cma, and I'm running into a few
problems when linking.

Even when external references to a bunch of C functions are removed
from stdlib implementation, the compiler still manages to link in
those external references.

Things like caml_sys_open, caml_output_value, caml_ml_seek_out, etc., etc.

Where the hell are these coming from? Are they built into the compiler
itself? As I can't find anything to explain it.

Jonathan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Annoying compiler magic
  2005-11-12 22:00 [Caml-list] Annoying compiler magic Jonathan Roewen
@ 2005-11-12 22:24 ` Eric Cooper
  2005-11-12 23:20   ` Jonathan Roewen
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Cooper @ 2005-11-12 22:24 UTC (permalink / raw)
  To: caml-list

On Sun, Nov 13, 2005 at 11:00:21AM +1300, Jonathan Roewen wrote:
> Where the hell are these coming from? Are they built into the compiler
> itself? As I can't find anything to explain it.

grep is your friend.

$ grep -r caml_sys_open .
./stdlib/pervasives.ml:external open_desc: string -> open_flag list ->
int -> int = "caml_sys_open"
./stdlib/filename.ml:external open_desc: string -> open_flag list ->
int -> int = "caml_sys_open"
./otherlibs/threads/pervasives.ml:external open_desc: string ->
open_flag list -> int -> int = "caml_sys_open"
./byterun/sys.c:CAMLprim value caml_sys_open(value path, value vflags,
value vperm)

-- 
Eric Cooper             e c c @ c m u . e d u


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Annoying compiler magic
  2005-11-12 22:24 ` Eric Cooper
@ 2005-11-12 23:20   ` Jonathan Roewen
  2005-11-13  0:27     ` Jonathan Roewen
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Roewen @ 2005-11-12 23:20 UTC (permalink / raw)
  To: caml-list

> grep is your friend.
>
> $ grep -r caml_sys_open .
> ./stdlib/pervasives.ml:external open_desc: string -> open_flag list ->
> int -> int = "caml_sys_open"
> ./stdlib/filename.ml:external open_desc: string -> open_flag list ->
> int -> int = "caml_sys_open"

Both of these instances are commented out, and replaced by functions
which raise an exception.

> ./otherlibs/threads/pervasives.ml:external open_desc: string ->
> open_flag list -> int -> int = "caml_sys_open"

> ./byterun/sys.c:CAMLprim value caml_sys_open(value path, value vflags,
> value vperm)

My custom runtime also removes this function.

This is a -custom- environment. The question is, why is the compiler
adding references to these symbols when my code (stdlib.cma &
libcamlrun.a) does NOT reference these.

Jonathan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Annoying compiler magic
  2005-11-12 23:20   ` Jonathan Roewen
@ 2005-11-13  0:27     ` Jonathan Roewen
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Roewen @ 2005-11-13  0:27 UTC (permalink / raw)
  To: caml-list

> This is a -custom- environment. The question is, why is the compiler
> adding references to these symbols when my code (stdlib.cma &
> libcamlrun.a) does NOT reference these.

You guys make life fun ;-) (Yes, note the sarcasm). So you define
these external functions INTO the compiler itself... an interesting
design...

Looks like I'll have to figure out how to break up the build system to
build JUST the ocamlc compiler and nothing else; use system tools for
everything else.

Is this to ensure your particular implementation of stdlib is
guaranteed to work? As I noticed an interesting error when trying to
build a custom compiler the naive way:

Error while linking ../../stdlib/stdlib.cma(Pervasives):
The external function `caml_ml_input' is not available

Anyways, I assume you did it like this for a good reason.

Jonathan =)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-13  0:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-12 22:00 [Caml-list] Annoying compiler magic Jonathan Roewen
2005-11-12 22:24 ` Eric Cooper
2005-11-12 23:20   ` Jonathan Roewen
2005-11-13  0:27     ` Jonathan Roewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).