From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 884FFBB81 for ; Mon, 26 Sep 2005 07:20:34 +0200 (CEST) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.207]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j8Q5KXbO032243 for ; Mon, 26 Sep 2005 07:20:34 +0200 Received: by xproxy.gmail.com with SMTP id t11so447927wxc for ; Sun, 25 Sep 2005 22:20:33 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OR5jFfXoxkF6aI72wzKBaBSnYEQT8E7EmM9hO/OE/+ZXg9A3+RRurNp1cAoVaYmkJ+2/ejJaVFycvFjVRA5P04QOEop/3i6ndFbL2zsLI55GrQ7xxPSFC7GzPfyCspaTUt3nAPJlyVwozNhJbqsiufgtkbFQsHYDRabp+cHmdHE= Received: by 10.70.31.20 with SMTP id e20mr2082170wxe; Sun, 25 Sep 2005 22:20:33 -0700 (PDT) Received: by 10.70.73.9 with HTTP; Sun, 25 Sep 2005 22:20:33 -0700 (PDT) Message-ID: Date: Mon, 26 Sep 2005 17:20:33 +1200 From: Jonathan Roewen Reply-To: Jonathan Roewen To: Jacques Garrigue Subject: Re: [Caml-list] Dynamic linking Cc: caml-list@yquem.inria.fr In-Reply-To: <20050926.141430.59032287.garrigue@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050926.141430.59032287.garrigue@math.nagoya-u.ac.jp> X-Miltered: at nez-perce with ID 43378521.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 struct:01 cmi:01 compilenv:01 cmx:01 ocaml:01 runtime:01 runtime:01 ocaml:01 syscalls:01 ...:98 ...:98 functions:01 kernel:01 kernel:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 > No document that I know, but the code is clear enough. > You may have a look at Env.read_pers_struct for .cmi and > Compilenv.read_unit_info for .cmx. > However I'm not sure it would help you very much in practice. > There are at least two other problems before you can do dynamic linking > of native code in ocaml: > * the code generator is geared toward static code, which means that it > cannot be handled by the runtime linker on many architectures > (I only know of a patch for x86) > * some glue code is generated at link time > So this looks like a rather difficult task... Well, we'd be building our very own custom runtime linker for starters. The idea goes something like: - a single [kernel mode] address space everything is run in. - somehow, necessary kernel symbols are exported (basically, what can be seen in interface files) - a runtime linker in the ocaml kernel loads ocaml code, and resolves symbols to kernel functions so can call into the kernel directly (no syscalls or IPC) - probably have some way of having a defined entry point for executables in ocaml code that's also exported, so kernel+linker can run the code without needing some C layer. Of course, the only problem here is: is it possible to do? ;-) I have no idea myself... =3D/ Jonathan