From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA05650; Tue, 6 Mar 2001 11:50:15 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA05659 for ; Tue, 6 Mar 2001 11:50:14 +0100 (MET) Received: from cremant.inria.fr (cremant.inria.fr [128.93.8.143]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f26AoCb17983; Tue, 6 Mar 2001 11:50:12 +0100 (MET) Received: (from lefessan@localhost) by cremant.inria.fr (8.11.0/8.11.0) id f26AoBb22377; Tue, 6 Mar 2001 11:50:11 +0100 X-Authentication-Warning: cremant.inria.fr: lefessan set sender to fabrice.le_fessant@inria.fr using -f From: Fabrice Le Fessant MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15012.49378.606313.795846@cremant.inria.fr> Date: Tue, 6 Mar 2001 11:50:10 +0100 (CET) To: Chris Hecker Cc: caml-list@inria.fr Subject: Re: [Caml-list] create a closure in external C function? References: <4.3.2.7.2.20010306011427.03669de0@shell16.ba.best.com> X-Mailer: VM 6.75 under Emacs 20.7.1 Reply-To: fabrice.le_fessant@inria.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk What you can do is create the closure in ML, and call a C stub inside this closure that will call your C function. I tried to implement what you were asking for (i.e. dlsym in Caml), but the main problem is building an arbitrary frame for the C call from the argument types. An example: I finally had a C function receiving three arguments. This function is called from a ML closure used as a stub for the function received by dlsym. "ml_call_1" is called with the C function as first parameter, a list of types as second parameter, and the argument as last parameter. value ml_ccall_1(value f_v, value types_v, value arg1_v) { } My problem is: how to call the function f_v, using the types in types_v (either integer, char, string or double) to build the call, and using arg1_v (translated using its type) as argument. Of course, I can implement this easily on my PC, but I don't know any way to implement such a function in an architecture-independant way... - Fabrice PS: I can give you the code I have already written for building the closure, and so on if you are interested... but I'm stuck on this function ! ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr