From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 8ABD5BC48 for ; Tue, 5 Apr 2005 23:12:54 +0200 (CEST) Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j35LCrbN007899 for ; Tue, 5 Apr 2005 23:12:54 +0200 Received: from localhost (calypso.cs.rice.edu [128.42.1.127]) by cs.rice.edu (Postfix) with ESMTP id 370AC4A9B0 for ; Tue, 5 Apr 2005 16:12:53 -0500 (CDT) Received: from cs.rice.edu ([128.42.1.30]) by localhost (calypso.cs.rice.edu [128.42.1.127]) (amavisd-new, port 10024) with LMTP id 13915-01-49 for ; Tue, 5 Apr 2005 16:12:52 -0500 (CDT) Received: from [10.249.235.235] (dunwlessnat.rice.edu [128.42.64.251]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by cs.rice.edu (Postfix) with ESMTP id B91EA4A9AF for ; Tue, 5 Apr 2005 16:12:52 -0500 (CDT) Mime-Version: 1.0 (Apple Message framework v619.2) Content-Transfer-Encoding: 7bit Message-Id: <263b229a999e9788124e5fc0129a814f@cs.rice.edu> Content-Type: text/plain; charset=US-ASCII; format=flowed To: caml-list@yquem.inria.fr From: Emir Pasalic Subject: Dynamic linking Date: Tue, 5 Apr 2005 16:12:51 -0500 X-Mailer: Apple Mail (2.619.2) X-Virus-Scanned: by amavis-2.2.1 at cs.rice.edu X-Miltered: at concorde with ID 4252FF55.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; dlopen:01 ocaml:01 bytecode:01 runtime:01 ocaml:01 runtime:01 alloc:01 macos:01 alloc:01 dlopen:01 macos:01 cygwin:01 cygwin:01 functions:01 compiles:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: We are writing a program that generates a C file, compiles it to a dynamic library, and uses dlopen (and such) to load it, execute it and bring its value into ocaml (bytecode) runtime. To do this, we need to use some of the functionality of the ocaml runtime (e.g., caml_alloc, caml_update) so we can marshall values from the C world into the world of ocaml. Our solution works on linux and macos platforms, but we have a problem trying to make it run on windows with Cygwin. So, we're trying to create a shared library on Cygwin that contains symbols such as "caml_alloc" and "caml_update". We do not know of a way to easily incorporate these symbols in the linking process, and so they remain undefined when we try to create a library, and undefined symbols are not allowed in Cygwin shared libraries. Therefore we tried to resort to another method, where the calls to caml_alloc and caml_update are replaced by calls to dlopen and dlsym functions, i.e., we were trying to do this: h = dlopen ("", RLTD_NOW); /* process error */ s = dlsym (h, "caml_alloc"); /* process error */ my_alloc = /* proper casting */ s; result = my_alloc ( /* arguments */ ); Assuming that this is possible, what is the name that should be given to the library? Else, is it possible to build a shared library on Cygwin that contains references to these symbols? Note that all this works perfectly fine on MacOS and linux which allow unresolved symbols in dynamic libraries, but Cygwin simply dies. Any Windows/Cygwin experts out there who can help us?