Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* C-Interface: CAMLreturn and failwith
@ 2006-01-20 12:18 Bauer, Christoph
  2006-01-20 12:39 ` [Caml-list] " Damien Doligez
  0 siblings, 1 reply; 2+ messages in thread
From: Bauer, Christoph @ 2006-01-20 12:18 UTC (permalink / raw)
  To: caml-list

Hi,

a question related to CAMLreturn and failwith in C-Stubcode:

Is this code correct:

#include <fail.h>
...

CAMLprim value prim( value unit ) 
{
   CAMLparam0();
   CAMLlocal( result );
   int error;
   /* allocate result, error has an errorcode */
   if( error ) failwith( "error");
   else CAMLreturn( result );
}

or should it be

CAMLprim value prim( value unit ) 
{
   CAMLparam0();
   CAMLlocal( result );
   int error;
   /* allocate result, error has an errorcode */
   if( error ) {
      caml_local_roots = caml__frame;
      failwith( "error");
   }
   else CAMLreturn( result );
} 

Thanks,

Christoph Bauer
Dipl. Inf.

LMS Deutschland GmbH
Luxemburgerstr. 7
D-67657 Kaiserslautern

T +49 631 303 22 152

mailto:Christoph.Bauer@lms-gmbh.de
http://www.lmsintl.com 


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

end of thread, other threads:[~2006-01-20 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-20 12:18 C-Interface: CAMLreturn and failwith Bauer, Christoph
2006-01-20 12:39 ` [Caml-list] " Damien Doligez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox