caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Dmitry Bely" <dmitry.bely@gmail.com>
To: "Caml List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Win32 library
Date: Sat, 16 Jun 2007 11:43:40 +0400	[thread overview]
Message-ID: <90823c940706160043h67486048ydfb03f74bacbf936@mail.gmail.com> (raw)
In-Reply-To: <20070615.224830.45002239.Christophe.Troestler@umh.ac.be>

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

On 6/16/07, Christophe TROESTLER <Christophe.Troestler+ocaml@umh.ac.be> wrote:
> Hi,
>
> I am fighting with the compilation of ocamlodbc under windows (code
> here: http://cvs.gna.org/cvsweb/ocamlodbc/?cvsroot=ocamlodbc).  The
> problem is
[...]
> (complete report attached).  What I find strange is that all other
> caml symbols are resolved (and ocamlrun.lib matches for
> _caml_local_roots).

Nothing strange: caml_local_roots is a variable (not a function) so it
exported differently in case of byte/native code Ocaml runtime
(dynamic/static library respectively). So you should compile your C
source files with  different compiler options, not just copy .obj
files as the library author does. In other words, INSTALL_WIN32.bat is
broken (some time ago I also run into that). Here are my changes
(.diff is attached):

- Fix compilation problems
- Use ODBC2
- DLL support for the byte code

- Dmitry Bely

P.S. In fact I finally wrote a couple-line Omakefile and forgot about
all that problems :)

[-- Attachment #2: ocamlodbc.diff --]
[-- Type: application/octet-stream, Size: 1960 bytes --]

Index: INSTALL_WIN32.bat
===================================================================
RCS file: D:\Work\cvsroot/config/ocamlodbc/INSTALL_WIN32.bat,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -r1.1 -r1.3
--- INSTALL_WIN32.bat	14 Sep 2006 13:51:31 -0000	1.1
+++ INSTALL_WIN32.bat	20 Sep 2006 16:37:10 -0000	1.3
@@ -7,17 +7,21 @@
 @echo -----------------------------------------
 
 @echo  Compile the external functions and create the dll
-cl /nologo /Ox /MD /DWIN32 -I "%OCAMLLIB%"\caml -c ocaml_odbc_c.c
-move ocaml_odbc_c.obj ocaml_odbc_c.d.obj
-link /nologo /dll /out:dllocamlodbc.dll /def:ocamlodbc.DEF  ocaml_odbc_c.d.obj "%OCAMLLIB%"\ocamlrun.lib  libodbc32.lib
+cl /nologo /Ox /MT /DWIN32 /DODBC2 -I "%OCAMLLIB%"\caml -c ocaml_odbc_c.c
+lib /nologo /out:libocamlodbc.lib ocaml_odbc_c.obj
+copy libocamlodbc.lib "%OCAMLLIB%"
+cl /nologo /Ox /MD /DCAML_DLL /DWIN32 /DODBC2 -I "%OCAMLLIB%"\caml -c ocaml_odbc_c.c -Foocaml_odbc_c.d.obj
+link /nologo /dll /out:dllocamlodbc.dll /def:ocamlodbc.DEF  ocaml_odbc_c.d.obj "%OCAMLLIB%"\ocamlrun.lib odbc32.lib
 copy dllocamlodbc.dll "%OCAMLLIB%"\stublibs
 
 @echo  Make a native code library
-ocamlopt -a -o ocamlodbc.cmxa ocaml_odbc.ml ocamlodbc.mli ocamlodbc.ml ocaml_odbc_c.obj -cclib -lodbc32
-copy ocamlodbc.cmxa "%OCAMLLIB%"
+ocamlopt -a -o ocamlodbc.cmxa ocaml_odbc.ml ocamlodbc.mli ocamlodbc.ml ocaml_odbc_c.obj -cclib odbc32.lib
+copy ocamlodbc.mli "%OCAMLLIB%"
 copy ocamlodbc.cmi "%OCAMLLIB%"
+copy ocamlodbc.cmxa "%OCAMLLIB%"
 
-@echo  Make a custom runtime library
-ocamlc -a -o ocamlodbc.cma -custom ocaml_odbc.ml ocamlodbc.mli ocamlodbc.ml ocaml_odbc_c.obj -dllib -locamlodbc  -cclib -lodbc32
-copy ocamlodbc.cma "%OCAMLLIB%"
+@echo  Make a byte code DLL
+ocamlc -a -o ocamlodbc.cma ocaml_odbc.ml ocamlodbc.mli ocamlodbc.ml -dllib -locamlodbc
+copy ocamlodbc.mli "%OCAMLLIB%"
 copy ocamlodbc.cmi "%OCAMLLIB%"
+copy ocamlodbc.cma "%OCAMLLIB%"

      parent reply	other threads:[~2007-06-16  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-15 20:48 Christophe TROESTLER
2007-06-15 21:19 ` [Caml-list] " Christophe TROESTLER
2007-06-16  7:43 ` Dmitry Bely [this message]

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=90823c940706160043h67486048ydfb03f74bacbf936@mail.gmail.com \
    --to=dmitry.bely@gmail.com \
    --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).