English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] mingw dll hell
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-02-27 (22:50)
Subject: [Caml-list] mingw dll hell
This refers to my earlier post about dll trouble.  I am having
inconsistent dll linking behavior, though things are getting better as I
futz with more flags.  Again, three weeks ago all this same code and
build scripts worked perfectly.  One thing I seem to be noticing is that
there are fewer errors if I do not link to libraries that depend on

Here is one case I do not understand.  Under some builds I can ocamlrun
an exe with success, but running the exe by itself crashes.  (An
exception is probably being thrown, but I can't see it.)  Running under
GDB runs successfully.  How can this be?

Jeff Henrikson


ocaml: 3.07pl2 mingw
pcre: 4.4
pcre-ocaml: 5.04.3
gcc: 3.3.1
windows: 2000

jefhen@HOXPCXJEFHEN ~/src/pcre-ocaml-5.04.3/lib
$ test

jefhen@HOXPCXJEFHEN ~/src/pcre-ocaml-5.04.3/lib
$ ocamlrun test.exe
this12.3 is 2.78a t3st.
12 3 2 78 3
jefhen@HOXPCXJEFHEN ~/src/pcre-ocaml-5.04.3/lib
$ test.exe

jefhen@HOXPCXJEFHEN ~/src/pcre-ocaml-5.04.3/lib
$ gdb test.exe
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
welcome to change it and/or distribute copies of it under certain
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
This GDB was configured as "i686-pc-cygwin"...(no debugging symbols
(gdb) run
Starting program: /cygdrive/c/src/pcre-ocaml-5.04.3/lib/test.exe
this12.3 is 2.78a t3st.
12 3 2 78 3
Program exited normally.
(gdb) quit

jefhen@HOXPCXJEFHEN ~/src/pcre-ocaml-5.04.3/lib


output_string stdout "hello\n"; flush stdout;

open Printf;;
open Pcre;;

let s = "this12.3 is 2.78a t3st.";;

let r = regexp "([0-9]+)";;

let a = extract_all ~full_match:false ~rex:r s;;

printf "%s\n" s;;

Array.iter (fun e -> printf "%s " e.(0)) a;;

flush stdout;


build commands:

ocamlc -c pcre.mli -o pcre.cmi
ocamlc -c pcre.ml -o pcre.cmo
gcc -mno-cygwin -D__MINGW32__ -I c:\ocaml\lib -I/usr/include -I
/usr/include/w32api -c pcre_stubs.c
gcc -mno-cygwin -shared -L `ocamlc -where` -o dllpcre_stubs.dll
-Wl,--out-implib,libpcre_stubs.a pcre_stubs.o -L . -lpcre-mingw `ocamlc
Creating library file: libpcre_stubs.a
Info: resolving _local_roots by linking to __imp__local_roots
chmod 777 dllpcre_stubs.dll
ocamlc -a -o pcre.cma pcre.cmo -dllib -lpcre_stubs

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