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.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id ED30DBC37 for ; Thu, 6 Aug 2009 23:17:40 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApQBAKPlekrLOwFrkWdsb2JhbACaRwEBAQEJCwoHEwS2boQYBQ X-IronPort-AV: E=Sophos;i="4.43,336,1246831200"; d="scan'208";a="32161466" Received: from outbound.icp-qv1-irony-out2.iinet.net.au ([203.59.1.107]) by mail3-smtp-sop.national.inria.fr with ESMTP; 06 Aug 2009 23:17:35 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAO/kekrLzuai/2dsb2JhbADRc4QYBQ X-IronPort-AV: E=Sophos;i="4.43,336,1246809600"; d="scan'208";a="547919269" Received: from unknown (HELO hendrix.mega-nerd.net) ([203.206.230.162]) by outbound.icp-qv1-irony-out2.iinet.net.au with ESMTP; 07 Aug 2009 05:17:31 +0800 Received: from hendrix.mnn (hendrix.mnn [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id 254901070CA for ; Fri, 7 Aug 2009 07:17:31 +1000 (EST) Date: Fri, 7 Aug 2009 07:17:31 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Subject: C wrappers and callbacks from Ocaml to C and back to Ocaml Message-Id: <20090807071731.bfd0d34b.mle+ocaml@mega-nerd.com> Reply-To: caml-list@inria.fr Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 2.6.0 (GTK+ 2.16.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 wrappers:01 callbacks:01 ocaml:01 struct:01 struct:01 cheers:01 define:02 erik:04 erik:04 passing:05 function:08 i'm:09 wrapper:10 clues:10 Hi all, I'm wrapping some C code that requires me to define a struct in Ocaml like this: type xt = { f : xt -> a } and then pass the struct to C which stores it, and later the C needs to find function f, call it from C, passing it the Ocaml xt struct. Anyone have any clues on how to do this? I have most of the rest of the C wrapper sorted out, its just this thats causing me any difficulty. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/