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 TAA15077; Tue, 6 Mar 2001 19:03:26 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 TAA12597 for ; Tue, 6 Mar 2001 19:03:26 +0100 (MET) Received: from mta6.snfc21.pbi.net (mta6.snfc21.pbi.net [206.13.28.240]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f26I3Pb02743 for ; Tue, 6 Mar 2001 19:03:25 +0100 (MET) Received: from checkerlap.d6.com ([64.160.54.42]) by mta6.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0G9S00LIEFFWN6@mta6.snfc21.pbi.net> for caml-list@inria.fr; Tue, 6 Mar 2001 10:02:21 -0800 (PST) Date: Tue, 06 Mar 2001 10:02:20 -0800 From: Chris Hecker Subject: Re: [Caml-list] dynamically loading C functions In-reply-to: X-Sender: def6@shell16.ba.best.com To: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk), caml-list@inria.fr Message-id: <4.3.2.7.2.20010306094319.00e2b8e0@shell16.ba.best.com> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Content-type: text/plain; charset="us-ascii" References: <4.3.2.7.2.20010304235205.00dea6a0@shell16.ba.best.com> <4.3.2.7.2.20010305164831.00e2cd60@shell16.ba.best.com> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >Do you indeed support returning functions from C? OK, so you need to >distinguish more than the OCaml type tells. For example by having two >functions of type 'a t -> 'b t -> ('a -> 'b) t: one to use between >arguments and another for the final result. Right, I thought of that, and I also thought of having a special token in the "type stream" that indicates a return value. Neither of these are quite as natural as I'd like, though. I think having a @@-> that you use between args and return isn't terrible, but it's just even more syntax to make this harder to use and more error prone. :) The get_function could raise an exception if every function in the specification didn't have a return type specifed, though. I've got it wired up to use the Bigarray ('a,'b) kind stuff now, so the caml function and the c function type signatures parallel each other as ('aa,'ab) t -> ('ba,'bb) t -> ('aa -> 'ba,'ab -> 'bb) t (and I can reuse the Bigarray type hierarchy, although I don't know how to get access to the internal definitions of the Bigarray abstract types which I need to actually return the information, I think...or maybe not, so I may need to copy them, which sucks...sometimes having "#include<>" is useful ;). As for whether I need to support returning functions, all of this is relative. I would really like to just solve the entire problem at once, if possible. I'd like to make this work for generic dynalinking, but the very case I was going to use first (wglGetProcAddress) does actually return a function pointer. :) Chris ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr