caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: "matthieu.dubuget@libertysurf.fr" <matthieu.dubuget@libertysurf.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] linking problem with camlidl on windows
Date: Fri, 18 Jul 2003 15:16:11 +0200	[thread overview]
Message-ID: <20030718151611.A15530@pauillac.inria.fr> (raw)
In-Reply-To: <HI7K0X$BC49DF383678652A6692C076E0A71DD6@tiscali.fr>; from matthieu.dubuget@libertysurf.fr on Fri, Jul 18, 2003 at 08:43:45AM +0200

> 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


  reply	other threads:[~2003-07-18 13:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-18  6:43 matthieu.dubuget
2003-07-18 13:16 ` Xavier Leroy [this message]
2003-07-21  8:41 matthieu.dubuget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030718151611.A15530@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=matthieu.dubuget@libertysurf.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).