Version française
Home     About     Download     Resources     Contact us    
Browse thread
problem creating .cma library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] problem creating .cma library

On 2009-12-31, at 00:30, Guillaume Yziquel wrote:

>> #include <stdio.h>
>> #include <caml/mlvalues.h>
>> #include "../mylib/mylib.h"
>> CAMLprim value
>> my_print_stub(value v) {
>
>      CAMLparam1(v);  /* is missing here, for garbage
>                         collection purposes. */
>
>>    char* str = (char*)String_val( v );
>
>      /* You do not need the right-hand side (char*) casting. */
>
>>    my_print( str );
>>    return Val_unit;
>> }

If you use CAMLparam1, you must use CAMLreturn instead of return.

-- Damien