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 WAA24932; Thu, 17 Jul 2003 22:38:33 +0200 (MET DST) 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 WAA25787 for ; Thu, 17 Jul 2003 22:38:32 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h6HKbuf25856; Thu, 17 Jul 2003 22:37:56 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA09855; Thu, 17 Jul 2003 22:37:55 +0200 (MET DST) Date: Thu, 17 Jul 2003 22:37:55 +0200 From: Xavier Leroy To: Richard Jones Cc: caml-list@inria.fr Subject: Re: [Caml-list] ocamlmklib on Windows Message-ID: <20030717223755.A9298@pauillac.inria.fr> References: <20030716150704.GA17252@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20030716150704.GA17252@redhat.com>; from rich@annexia.org on Wed, Jul 16, 2003 at 04:07:04PM +0100 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 camlimages:01 mismatch:01 dlls:01 statically:01 runtime:01 dynamically:01 indirection:01 declspec:01 dllimport:01 mingw:01 otherlibs:01 linked:01 ocaml:01 caml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Has anyone successfully compiled ocamlmklib on Windows? I'd like to > build a Windows native port of camlimages, but lack of this program in > the basic distribution is stopping me. There's a mismatch between the ocamlmklib approach and Windows DLLs that has prevented me so far from making the former work with the latter. Basically, ocamlmklib assumes that, from the *same* set of object C files, one can build both - a static library that can be statically linked with the Caml runtime system and the application, and - a shared library (DLL) that can be dynamically linked with the Caml runtime system and the application. This does *not* appear to be the case for Windows. Namely, a static lib that accesses a global variable defined in the Caml runtime system does this directly, while a DLL must do it through one additional indirection. Thus, the code for the library must be compiled differently (using / not using "__declspec(dllimport)" specifiers) depending on whether it is to be put in a static library or in a DLL. With the Mingw toolchain, it seems possible to generate code that works in both contexts, but I was unable to do this with the MSVC toolchain. So, no ocamlmklib under Windows. Still, you can look at some of the Win32 makefiles in the OCaml source distribution for examples of how to build mixed C/Caml libraries under Windows. (Look at otherlibs/win32unix/Makefile.nt for instance.) - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners