From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 BAFFFBCAB for ; Tue, 24 May 2005 06:30:04 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4O4U3nF008653 for ; Tue, 24 May 2005 06:30:03 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id GAA25566 for ; Tue, 24 May 2005 06:30:03 +0200 (MET DST) Received: from rabbit.math.nagoya-u.ac.jp (rabbit.math.nagoya-u.ac.jp [133.6.130.5]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4O4U0R4008544 for ; Tue, 24 May 2005 06:30:02 +0200 Received: from localhost (millas [172.16.30.29]) by rabbit.math.nagoya-u.ac.jp (8.12.11/3.7W) with ESMTP id j4O4TxBd009031; Tue, 24 May 2005 13:29:59 +0900 (JST) Date: Tue, 24 May 2005 13:29:51 +0900 (JST) Message-Id: <20050524.132951.104054009.garrigue@mailhost.math.nagoya-u.ac.jp> To: roessler@rftp.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] ocamlopt and *using* DLLs From: Jacques Garrigue In-Reply-To: <4292A58D.207@rftp.com> References: <4292A58D.207@rftp.com> X-Mailer: Mew version 4.0.69 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4292ADCB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4292ADC8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlopt:01 dlls:01 beginners:01 dlls:01 ocamlopt:01 compiler:01 ocamlc:01 lib:01 ocamlc:01 -cclib:01 -cclib:01 model:01 stub:01 stub: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: From: Robert Roessler > I tried this on the beginners list, but may not have been asking the > right question(s)... :) Doesn't look like a beginner question... > 1) Can DLLs appear as input to the ocamlopt compiler like they can > with ocamlc? The manual says "yes": "Arguments ending in .o, .a or > .so (.obj, .lib and .dll under Windows) are assumed to be C object > files and libraries. They are linked with the program." > > I get "ocamlopt.opt: don't know what to do with ml_scintilla.dll." Indeed, looking at the sources, .so/.dll is only handled in ocamlc, not in ocamlopt. That means that, in ocamlopt, you must either provide a static library, or use the -cclib option and hope that the system linker does the right thing. In practice, -cclib ml_scintilla.so should work on Unix, but the .dll equivalent is not going to work on Windows, as the linker does not support it. > 2) If DLLs can in fact be used with ocamlopt, is the model the same as > with ocamlc? In particular, > > 2a) can I use them *without* stub libraries? If by stub you mean the ml_scintilla.lib that the windows librarian builds for you, then you will need it with ocamlopt (but not with ocamlc). Of course in both cases you also need an ocaml specific stub library to wrap calls. > 2b) can I in general expect that an app that works well with ocamlc > and a collection of OCaml cma libs and compiled DLLs (LablGTK and > associated runtime) will work with ocamlopt - assuming that I generate > and replace cmo/cma files with cmx/cmxa files? Except these linking problems, you can assume identical behaviour. If there are significant discrepancies, please report them. Jacques Garrigue