From: "Nicolas Cannasse" <warplayer@free.fr>
To: <caml-list@inria.fr>, "Ohad Rodeh" <ORODEH@il.ibm.com>
Subject: Re: [Caml-list] Packaging a caml library a DLL
Date: Wed, 7 Aug 2002 16:23:07 +0200	[thread overview]
Message-ID: <000801c23e1d$f399c5b0$0700a8c0@warp> (raw)
In-Reply-To: <OFF1D23C90.CBFB87E4-ONC2256C0E.004DB676@telaviv.ibm.com>
> List,
> I'm having a lot of trouble packaging a caml library (Ensemble) as a
> DLL on win32.  Creating a win32 static library is easy, shared libraries
on
> Unix
> are a breeze, however, win32 DLLs are really problematic.
>
>    Has anybody been able to do this? any example makefiles?
Here's the Makefile Harry Chomsky & me are using for the Win32 API.
Look at "dynamic" built.
It's working without any problem with bytecode compilation. However, native
compilation with DLL won't work due to the need to link with ocamlrun.lib.
Nicolas Cannasse
----------------
CFLAGS=-ccopt /W3 -ccopt /YX -ccopt /Fpwin32.pch
WINLIBS=user32.lib gdi32.lib shell32.lib advapi32.lib comctl32.lib
comdlg32.lib
CCWINLIBS=-cclib user32.lib -cclib gdi32.lib -cclib shell32.lib -cclib
advapi32.lib -cclib comctl32.lib -cclib comdlg32.lib
EXTFLAGS= -I ext
MODULES=  win32_bitmap.+ ..... ( other C files )
######################################################################
# TARGETS :
all : static dynamic opt mkwinapp
static : libwin32.lib win32.cma lkwinapp.obj test_static.exe
dynamic : dllwin32.dll win32.cma test_dynamic.exe
opt : libwin32.lib win32.cmxa lkwinapp.obj test_opt.exe
mkwinapp : mkwinapp.exe
######################################################################
# BUILDS :
libwin32.lib : win32_core.sobj $(MODULES:+=sobj)
    -@del $@ 2>NUL
    lib /out:$@ $**
dllwin32.dll : win32_core.dobj $(MODULES:+=dobj)
    -@del $@ 2>NUL
    link $(WINLIBS) ocamlrun.lib /dll /out:$@ $**
win32.cma : win32_core.cmo $(MODULES:+=cmo) win32.cmo
    ocamlc -a -o $@ -cclib -lwin32 $(CCWINLIBS) -dllib dllwin32 $**
win32.cmxa : win32_core.cmx $(MODULES:+=cmx) win32.cmx
    ocamlopt -a -o $@ -cclib -lwin32 $(CCWINLIBS) $**
win32_core.cmi : win32_core.mli
    ocamlc -c $**
win32_core.cmo : win32_core.cmi win32_core.ml
win32_core.cmx : win32_core.cmi win32_core.ml
win32.cmo : win32_core.cmo $(MODULES:+=cmo) win32.ml
win32.cmx : win32_core.cmx $(MODULES:+=cmx) win32.ml
mkwinapp.exe : mkwinapp.ml
    ocamlc -o $@ unix.cma $**
test_static.exe : win32.cma test.ml test_res.obj libwin32.lib lkwinapp.obj
    ocamlc -o $@ -custom win32.cma test.ml test_res.obj lkwinapp.obj
test_dynamic.exe : win32.cma testnores.ml
    ocamlc -o $@ win32.cma testnores.ml
test_opt.exe : win32.cmxa test.ml test_res.obj libwin32.lib lkwinapp.obj
    ocamlopt -o $@ win32.cmxa test.ml test_res.obj lkwinapp.obj
######################################################################
# SUFFIXES :
.c.obj :
    ocamlc $(CFLAGS) $*.c
.c.sobj :
    ocamlc $(CFLAGS) -ccopt /Fo$@ $*.c
.c.dobj :
    ocamlc $(CFLAGS) -ccopt /Fo$@ -ccopt /MD $*.c
.rc.obj :
    rc $*.rc
    cvtres /machine:ix86 $*.res
    @del $*.res
.ml.cmo :
    ocamlc $(EXTFLAGS) -c $*.ml
.ml.cmx :
    ocamlopt $(EXTFLAGS) -c $*.ml
-------------------
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
next prev parent reply	other threads:[~2002-08-07 14:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-07 14:12 Ohad Rodeh
2002-08-07 14:23 ` Nicolas Cannasse [this message]
2002-08-08 12:33 ` Xavier Leroy
2002-08-09  8:13 Ohad Rodeh
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='000801c23e1d$f399c5b0$0700a8c0@warp' \
    --to=warplayer@free.fr \
    --cc=ORODEH@il.ibm.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