[Omake] building C binding library

Aleksey Nogin anogin at hrl.com
Mon Sep 17 09:49:52 PDT 2007


On 16.09.2007 03:37, Anastasia Gornostaeva wrote:

> How can I rewrite a piece of OCamlMakefile into OMakefile:
> 
> SOURCES         = mlzlib.mli mlzlib.ml mlzlib_stub.c
> OCAMLLDFLAGS    = -cclib -lz
> RESULT          = mlzlib
> all: bcl ncl
> 
> It should build ocaml library mlzlib, a bindig to C zlib functuibs

You will need something like

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.

Aleksey

-- 
Aleksey Nogin, Research Scientist
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA


More information about the Omake mailing list