Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Interface between Ocaml and Assembler
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <alain@f...>
Subject: Re: [Caml-list] Interface between Ocaml and Assembler
David LONY wrote:
> Is it possible to interface assembler code with an Ocaml code ? I 
> it possible to call a Ocaml function from an assembler code by 
> using the asm instruction "call my_function" (gas asm)?

Yes, you can call an OCaml function from assembler using the same method 
as from C, that is through caml_callback* functions (see Section 18.7.1 
in the OCaml manual). However, dealing with the GC properly in assembler 
is tricky: you'll have to reproduce the behavior of the CAMLlocal and 
CAMLparam macros.

-- Alain