Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] custom toplevel under darwin
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: jehenrik <jehenrik@y...>
Subject: [Caml-list] custom toplevel under darwin
Are custom toplevels supposed to work under darwin with ocaml 3.06?  I 
have a simple .cpp file from the OReily book:


#include <stdio.h>
#include <caml/mlvalues.h>

extern "C" value inspect (value v)
   if (Is_long(v))
     printf ("integer (%ld) : %ld", (long) v, Long_val(v));
   else if (Is_block(v))
     printf ("v is a pointer");
     printf ("v is neither an integer nor a pointer (???)");
   printf("   ");
   fflush(stdout) ;
   return v ;

and a simple .ml file,

external inspect1 : 'a -> 'a = "inspect" ;;
inspect1 123;;

As a standalone program this works fine:

ocamlc -custom inspect.o -o intro_runtime # this works

But this way of making a toplevel, along with all the variations I can 
think of, doesn't:

ocamlmktop -custom inspect.o  -o intro_runtime

# external inspect1 : 'a -> 'a = "inspect" ;;
external inspect1 : 'a -> 'a = "inspect"
# inspect1;;
The external function `inspect' is not available
# inspect1 123;;
The external function `inspect' is not available

If this functionality is not ported, I would appreciate it if somebody 
could pass that on to me.

Jeff Henrikson

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: