caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "matthieu.dubuget@libertysurf.fr" <matthieu.dubuget@libertysurf.fr>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] linking problem with camlidl on windows
Date: Fri, 18 Jul 2003 08:43:45 +0200	[thread overview]
Message-ID: <HI7K0X$BC49DF383678652A6692C076E0A71DD6@tiscali.fr> (raw)

Hello!

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.

There are 4 files :
somme.c, somme.def, somme.idl, somme_stubs.def

**** somme.c ****
#include "somme.h"

char * toto[3] = { "un", "deux", "trois" };

handle get(int indice){
  return toto[indice];
}

char * string_of_handle(handle h){
  return (char *) h;
}
**** somme.c ****
**** somme.def *****
EXPORTS
    get
    string_of_handle
**** somme.def *****

Here is the somme.idl file :

**** somme.idl ****
typedef [abstract] char *  handle;

handle get([in] int indice);

[string] char * string_of_handle([in] handle h);
**** somme.idl ****
**** somme_stubs.def ****
EXPORTS
    camlidl_somme_get
    camlidl_somme_string_of_handle
**** somme_stubs.def ****

Here are the steps (*files are the 4 hand-written files):

                           
*somme.def|-3->somme.dll|-5->somme_stubs.dll
               *somme.c|-2-> somme.obj|             |
*somme.idl-1->|somme.h                              |
              |somme_stubs.c-4->    somme_stubs.obj |
              |                    *somme_stubs.def |
              |somme.ml
              |somme.mli

1/ ocamlidl -header somme.idl
2/ cl /c somme.c
3/ link /dll /out:somme.dll /def:somme.def somme.obj
4/ ocamlc -c somme_stubs.c

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?

FIRST TRY:
link /dll /out:somme_stubs.dll /def:somme_stubs.def
somme_stubs.obj somme.lib
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

   Creating library somme_stubs.lib and object somme_stubs.exp
somme_stubs.obj : error LNK2001: unresolved external symbol
_alloc
somme_stubs.obj : error LNK2001: unresolved external symbol
_camlidl_free
somme_stubs.obj : error LNK2001: unresolved external symbol
_copy_string
somme_stubs.dll : fatal error LNK1120: 3 unresolved externals

SECOND TRY (worse):
link /dll /out:somme_stubs.dll /def:somme_stubs.def
somme_stubs.obj somme.lib /libpath:"c:/ocaml/lib" libcamlidl.lib
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

   Creating library somme_stubs.lib and object somme_stubs.exp
somme_stubs.obj : error LNK2001: unresolved external symbol
_alloc
somme_stubs.obj : error LNK2001: unresolved external symbol
_copy_string
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol _invalid_argument
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol _alloc_small
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol _local_roots
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol _stat_alloc
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol _raise_out_of_memory
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol __imp__CoTaskMemAlloc@4
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol __imp__CoTaskMemFree@4
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol _stat_free
libcamlidl.lib(idlalloc.obj) : error LNK2001: unresolved
external symbol _string_length
somme_stubs.dll : fatal error LNK1120: 11 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.

COMMENTS:
I did the same thing on linux and it worked fine.
I did it with a simpler idl file on windows (without
abstract type definition) and it worked too.

Where am I wrong ?

Thanks in advance

Matthieu Dubuget


********** L'ADSL A 20 EUR/MOIS**********
Tiscali propose l'ADSL le moins cher du marché : 20 EUR/mois et le modem ADSL offert ! 
Pour profiter de cette offre exceptionnelle, cliquez ici : http://register.tiscali.fr/adsl/
Offre soumise à conditions.


-------------------
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  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-18  6:43 matthieu.dubuget [this message]
2003-07-18 13:16 ` Xavier Leroy
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='HI7K0X$BC49DF383678652A6692C076E0A71DD6@tiscali.fr' \
    --to=matthieu.dubuget@libertysurf.fr \
    --cc=caml-list@inria.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).