Browse thread
[Caml-list] linking_problem_with_camlidl_on_windows
- matthieu.dubuget@libertysurf.fr
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | matthieu.dubuget@libertysurf.fr <matthieu.dubuget@l...> |
| Subject: | [Caml-list] linking_problem_with_camlidl_on_windows |
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