[Omake] building C binding library

Aleksey Nogin nogin at metaprl.org
Mon Sep 17 17:11:15 PDT 2007


On 17.09.2007 11:46, Anastasia Gornostaeva wrote:

> On Mon, Sep 17, 2007 at 09:49:52AM -0700, Aleksey Nogin wrote:
> 
>>  section
>>     BYTE_ENABLED = true
>>     OCAML_LINK_FLAGS += -cclib -lz
>>     StaticCLibrary(mlzlib_stub, mlzlib_stub)
>>     OCAML_CLIBS += mlzlib_stub
>>     .DEFAULT: $(OCamlLibrary mlzlib, mlzlib)
>>
>>  Note that OMake's OCaml.om currently does not support linking "foreign" 
>>  objects into libraries, so the above code links the mlzlib_stub.c into a C 
>>  library first and then links in that library into the mlzlib OCaml library.
> 
> I copied that piece and removed only BYTE_ENABLED line out.
> It does not work for me: it does not compile mlzlib_stub.c at all.
> 

You are right - currently OCamlLibrary does not pay attention to
OCAML_CLIBS, so you'll need to do thinks a bit more manually:

section
   CFILES = mczlib_stub$(EXT_OBJ)
   OCAML_LINK_FLAGS += -cclib -lz $(CFILES)
   OCAMLLIBS = $(OCamlLibrary mlzlib, mlzlib)
   $(OCAMLLIBS): $(CFILES)
   .DEFAULT: $(OCAMLLIBS)

Aleksey


More information about the Omake mailing list