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
Re: [Caml-list] void/unit in C calls
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-02-20 (20:17)
From: Lars Nilsson <lazarus13@h...>
Subject: Re: [Caml-list] void/unit in C calls
>It makes a difference: you should always return Val_unit from
>unit-functions implemented in C. Otherwise you might find obscure
>things like:
>   foo () <> ()
>Or worse... - somebody reported to me that he sometimes saw programs
>crash, though it isn't certain that this was the cause.

Does this indicate an error in the O'Caml manual, section 18.5.1, where

  void foo(value v1, value v2, value v3)
    CAMLparam3(v1, v2, v3);


is used, in addition to a paragraph preceeding it in the same section saying 
"If your C function is a procedure you must insert CAMLreturn0 at the end"? 
In fact, CAMLreturn0 existing at all seems to imply the fact that 
unit-returning functions (from O'Caml's point of view) can be void in the C 


Say “good-bye” to spam, viruses and pop-ups with MSN Premium -- free trial 

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