Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ocamlopt with external function taking more than 5 params
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lars Nilsson <lars@q...>
Subject: [Caml-list] ocamlopt with external function taking more than 5 params
Hi all,

I am wondering if I am doing something wrong, or if I am experiencing a bug.
I am trying to implement a function in C that takes more than 5 parameters
(8 in my real code). For some reason it does not appear that the native code
version is being called properly. If anyone can shed any light on this I
would be very grateful...

The resulting output for the ocamlopt compiled program is

  Pointer = 0x3, N = 5

This is of course not exactly what I would expect, since I would really like
to see a valid array of values containing integers.

I am attempting this under RH7.2 Linux, gcc 2.95.3, using both Ocaml 3.06
and the current CVS version, with the same result.

Thanks in advance for any insights,

Lars Nilsson
Quantum Chamaeleon
http://www.quantumchamaeleon.com

[tester.ml]
external tester : int -> int -> int -> int -> int -> int -> int -> int ->
unit = "tester_bytecode" "tester_native"

let _ =
  tester 1 2 3 4 5 6 7 8

[c-tester.c]
CAMLprim void tester_bytecode(value a, value b, value c, value d,
                              value e, value f, value g, value h)
{
     CAMLparam5(a, b, c, d, e);
     CAMLxparam3(f, g, h);

     printf("Doing nothing\n");

     CAMLreturn0;
}

CAMLprim void tester_native(value *argv, int argc)
{
     CAMLparamN(argv, argc);

     printf("Pointer = %p, N = %d\n", argv, argc);

     CAMLreturn0;
}

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners