From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 607B7BC69 for ; Fri, 4 Jan 2008 10:43:40 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAHKOfUdQDPIBlmdsb2JhbACQEAEBAQEHBAYiB5or X-IronPort-AV: E=Sophos;i="4.24,244,1196636400"; d="scan'208";a="5716225" Received: from smtp19.orange.fr ([80.12.242.1]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Jan 2008 10:43:37 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1904.orange.fr (SMTP Server) with ESMTP id 0042C1C00094 for ; Fri, 4 Jan 2008 10:43:37 +0100 (CET) Received: from [192.168.1.59] (APuteaux-154-1-66-105.w81-249.abo.wanadoo.fr [81.249.49.105]) by mwinf1904.orange.fr (SMTP Server) with ESMTP id CB2691C00083; Fri, 4 Jan 2008 10:43:36 +0100 (CET) X-ME-UUID: 20080104094336832.CB2691C00083@mwinf1904.orange.fr Message-ID: <477DFFC7.8@frisch.fr> Date: Fri, 04 Jan 2008 10:43:35 +0100 From: Alain Frisch User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: David LONY Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Interface between Ocaml and Assembler References: <477DFF6C.1070409@pragmadev.com> In-Reply-To: <477DFF6C.1070409@pragmadev.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; frisch:01 frisch:01 ocaml:01 ocaml:01 camlparam:01 wrote:01 caml-list:01 functions:01 macros:01 alain:01 alain:01 callback:02 caml:02 assembler:02 assembler:02 David LONY wrote: > Is it possible to interface assembler code with an Ocaml code ? I > mean..is 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