Browse thread
Caml interface with C on x86_64
[
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: | Li-Thiao-Té_Sébastien <Sebastien.Li-thiao-te@c...> |
| Subject: | Caml interface with C on x86_64 |
Hi,
I am using OCaml on two different Debian systems, a P4 machine at home
and an Opteron machine at work. The following C function works well on
the P4 but crashes on the Opteron with "Signal -10" :
value test_liste (value str) {
// test function to return a list to caml
CAMLparam1(str);
CAMLlocal1(cons);
printf("This is test_liste.\n");
printf(String_val(str));
fflush(stdout);
cons = caml_alloc (2,0);
Store_field (cons, 0, Val_int(3));
Store_field (cons, 1, Val_int(0));
if (Is_block(cons)) { printf("true\n");};
fflush(stdout);
printf("cons has size %i \n",Wosize_val(cons));
fflush(stdout);
CAMLreturn (Val_int(0));
}
called from a custom toplevel system :
external test_liste : string -> int list = "test_liste";;
test_liste "oaue";;
The function works with gcc-3.4 and gcc-4.0 on the P4 but crash with
both on the opteron machine. Can anybody explain this error?
P4 configuration :
uname -a
Linux 2.6.15-1-686-smp #1 SMP Tue Jan 3 10:19:10 UTC 2006 i686 GNU/Linux
ocamlc -v
The Objective Caml compiler, version 3.09.1
gcc-3.4 -v
gcc version 3.4.6 20060302 (prerelease) (Debian 3.4.5-3)
gcc -v
Target: i486-linux-gnu
gcc version 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)
Opteron configuration :
uname -a
Linux 2.6.14-2-amd64-k8-smp #1 SMP Sun Nov 27 02:29:11 UTC 2005 x86_64
GNU/Linux
ocamlc -v
The Objective Caml compiler, version 3.09.1
gcc-3.4 -v
gcc version 3.4.6 20060302 (prerelease) (Debian 3.4.5-3)
gcc -v
Target: x86_64-linux-gnu
gcc version 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)
--
Li-Thiao-Té Sébastien