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 PAA31496; Fri, 18 Jul 2003 15:16:18 +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 PAA06828 for ; Fri, 18 Jul 2003 15:16:17 +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 h6IDGCf23756; Fri, 18 Jul 2003 15:16:12 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA08239; Fri, 18 Jul 2003 15:16:11 +0200 (MET DST) Date: Fri, 18 Jul 2003 15:16:11 +0200 From: Xavier Leroy To: "matthieu.dubuget@libertysurf.fr" Cc: caml-list Subject: Re: [Caml-list] linking problem with camlidl on windows Message-ID: <20030718151611.A15530@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from matthieu.dubuget@libertysurf.fr on Fri, Jul 18, 2003 at 08:43:45AM +0200 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 somme:01 libpath:01 ocamlrun:01 runtime:01 dlls:01 ocaml:01 camlidl:01 stubs:01 lib:01 linking:02 external:03 dll:03 obj:03 library:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I posted a question some days ago, but it was not very precise. > I am trying to use one DLL from Ocaml with camlidl. > Since I can't have this work on windows (no problem under > linux) because of linking problems, I reproduced it there. > [...] > 5/ Here is the step I cannot pass, because there are always > unresolved external symbols. I cannot guess which library I > should link? Is it possible that I made something wrong when > installing camlidl? You can go one step further this way: link /dll /out:somme_stubs.dll /def:somme_stubs.def \ somme_stubs.obj somme.lib \ /libpath:"c:/ocaml/lib" libcamlidl.lib ocamlrun.lib ole32.lib somme_stubs.obj references symbols from libcamlidl.lib, and libcamlidl.lib references symbols from the OCaml runtime system, hence the need to link the import library for the latter, ocamlrun.lib. However, you run into the problem with Windows DLLs that I described in my message of yesterday: libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved external symbol _local_roots That is, libcamlidl.lib was compiled for static linking with the OCaml runtime system, not for dynamic linking. Import libraries bridge the differences between static and dynamic linking in the case of references to functions, but not in the case of references to global variables such as "local_roots". So, basically, you can't do what you want to do with the current version of CamlIDL. The CamlIDL library would need to be compiled as a DLL itself for this to work. > I did the same thing on linux and it worked fine. Welcome to the wonderful world of Windows DLL :-) - 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