Browse thread
Segfault using malloc within stubs
- julius
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | julius <flute@n...> |
| Subject: | Segfault using malloc within stubs |
Hello,
I have this strange problem with my stubs, I wrote this function but it
leads to a segfault:
CAMLprim value foo(value v)
{
CAMLparam1(v);
CAML(result);
char** test;
test=(char**)malloc(4*sizeof(char*));
CAMLreturn(result);
}
After much tests, it seems that malloc is not allowed when using Caml
data types or when trying to register data to the ocaml garbage
collector... But I don't understand why as C heap and OCaml heap are
distinct :-/
Thanks,
Julius