caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] custom toplevel under darwin
@ 2002-11-12  7:27 jehenrik
  2002-11-12  9:17 ` Lex Stein
  0 siblings, 1 reply; 3+ messages in thread
From: jehenrik @ 2002-11-12  7:27 UTC (permalink / raw)
  To: caml-list

Are custom toplevels supposed to work under darwin with ocaml 3.06?  I 
have a simple .cpp file from the OReily book:


inspect.c:

#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");
   else
     printf ("v is neither an integer nor a pointer (???)");
   printf("   ");
   fflush(stdout) ;
   return v ;
}




and a simple .ml file, intro_runtime.ml:

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



As a standalone program this works fine:

ocamlc -custom inspect.o intro_runtime.ml -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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] custom toplevel under darwin
  2002-11-12  7:27 [Caml-list] custom toplevel under darwin jehenrik
@ 2002-11-12  9:17 ` Lex Stein
  2002-11-12 12:44   ` jehenrik
  0 siblings, 1 reply; 3+ messages in thread
From: Lex Stein @ 2002-11-12  9:17 UTC (permalink / raw)
  To: jehenrik; +Cc: caml-list


Try:

ocamlmktop -custom inspect.o intro_runtime.ml -o top

This works for me Ocaml 3.06 / OS X 10.2 with the inspect.c example from
the O'Reilly book.

Does it work for you ? If not, what are the error messages ?

Lex

On Tue, 12 Nov 2002, jehenrik wrote:

> Are custom toplevels supposed to work under darwin with ocaml 3.06?  I
> have a simple .cpp file from the OReily book:
>
>
> inspect.c:
>
> #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");
>    else
>      printf ("v is neither an integer nor a pointer (???)");
>    printf("   ");
>    fflush(stdout) ;
>    return v ;
> }
>
>
>
>
> and a simple .ml file, intro_runtime.ml:
>
> external inspect1 : 'a -> 'a = "inspect" ;;
> inspect1 123;;
>
>
>
> As a standalone program this works fine:
>
> ocamlc -custom inspect.o intro_runtime.ml -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 caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] custom toplevel under darwin
  2002-11-12  9:17 ` Lex Stein
@ 2002-11-12 12:44   ` jehenrik
  0 siblings, 0 replies; 3+ messages in thread
From: jehenrik @ 2002-11-12 12:44 UTC (permalink / raw)
  To: Lex Stein; +Cc: caml-list

Ah, got it.  Has nothing to do with portability.  The external 
definitions must be in a file named .ml, not .mli in order to get linked 
in.

Thanks for helping me with my debugging myopia.


Jeff Henrikson



On Tuesday, November 12, 2002, at 04:17 AM, Lex Stein wrote:

>
> Try:
>
> ocamlmktop -custom inspect.o intro_runtime.ml -o top
>
> This works for me Ocaml 3.06 / OS X 10.2 with the inspect.c example from
> the O'Reilly book.
>
> Does it work for you ? If not, what are the error messages ?
>
> Lex
>
> On Tue, 12 Nov 2002, jehenrik wrote:
>
>> Are custom toplevels supposed to work under darwin with ocaml 3.06?  I
>> have a simple .cpp file from the OReily book:
>>
>>
>> inspect.c:
>>
>> #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");
>>    else
>>      printf ("v is neither an integer nor a pointer (???)");
>>    printf("   ");
>>    fflush(stdout) ;
>>    return v ;
>> }
>>
>>
>>
>>
>> and a simple .ml file, intro_runtime.ml:
>>
>> external inspect1 : 'a -> 'a = "inspect" ;;
>> inspect1 123;;
>>
>>
>>
>> As a standalone program this works fine:
>>
>> ocamlc -custom inspect.o intro_runtime.ml -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 caml-list-request@inria.fr Archives: 
>> http://caml.inria.fr
>> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: 
>> http://caml.inria.fr/FAQ/
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>>
>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2002-11-12 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-12  7:27 [Caml-list] custom toplevel under darwin jehenrik
2002-11-12  9:17 ` Lex Stein
2002-11-12 12:44   ` jehenrik

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).