caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Packaging a caml library a DLL
@ 2002-08-07 14:12 Ohad Rodeh
  2002-08-07 14:23 ` Nicolas Cannasse
  2002-08-08 12:33 ` Xavier Leroy
  0 siblings, 2 replies; 4+ messages in thread
From: Ohad Rodeh @ 2002-08-07 14:12 UTC (permalink / raw)
  To: caml-list

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?

Thanks,
      Ohad.

-----------------------------------------------------------------------------------

Ohad Rodeh
tel: +972-3-6401641
IBM Haifa, storage research

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Packaging a caml library a DLL
  2002-08-07 14:12 [Caml-list] Packaging a caml library a DLL Ohad Rodeh
@ 2002-08-07 14:23 ` Nicolas Cannasse
  2002-08-08 12:33 ` Xavier Leroy
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Cannasse @ 2002-08-07 14:23 UTC (permalink / raw)
  To: caml-list, Ohad Rodeh

> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Packaging a caml library a DLL
  2002-08-07 14:12 [Caml-list] Packaging a caml library a DLL Ohad Rodeh
  2002-08-07 14:23 ` Nicolas Cannasse
@ 2002-08-08 12:33 ` Xavier Leroy
  1 sibling, 0 replies; 4+ messages in thread
From: Xavier Leroy @ 2002-08-08 12:33 UTC (permalink / raw)
  To: Ohad Rodeh; +Cc: caml-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?

CamlIDL contains a shell script that does just this in order to
package Caml code as a COM DLL.  You can view the script here:

http://camlcvs.inria.fr/cgi-bin/cvsweb.cgi/bazar-ocaml/camlidl/tools/camlidldll.tpl

The script contains some COM-specific stuff, but not much.

Hope this helps,

- Xavier Leroy
-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Packaging a caml library a DLL
@ 2002-08-09  8:13 Ohad Rodeh
  0 siblings, 0 replies; 4+ messages in thread
From: Ohad Rodeh @ 2002-08-09  8:13 UTC (permalink / raw)
  To: caml-list


List,
    Thanks for the replies, hopefully, they will solve my problems,

      Ohad.
-----------------------------------------------------------------------------------

Ohad Rodeh
tel: +972-3-6401641
IBM Haifa, storage research

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-09  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-07 14:12 [Caml-list] Packaging a caml library a DLL Ohad Rodeh
2002-08-07 14:23 ` Nicolas Cannasse
2002-08-08 12:33 ` Xavier Leroy
2002-08-09  8:13 Ohad Rodeh

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).