[Omake] Interfacing with C code
Luis O'Shea
loshea at gmail.com
Sun Feb 3 04:47:31 PST 2008
Thank you. That works.
Before the StaticCLibrary one needs to append the path to caml
headers to the INCLUDES variable. Is there any other way to find
this path other than to parse it out of "ocamlc -v"?
Thanks again.
On Feb 3, 2008, at 1:45 AM, Sashan Govender wrote:
> I have had to do something similar using OMake. I make a library of my
> C object files and then use the variable OCAML_CLIBS in my Omakefile
> that calls OCamlProgram.
>
> e.g:
> #In my library OMakefile
> StaticCLibrary(my_lib, file1 file2)
>
> #in my ocaml program makefile
> OCAML_CLIBS=<path_to_lib>/my_lib
>
> OCamlProgram(my_program, $(files))
>
> This technique won't put the *.o files on the command line (like you
> mentioned) but for my purposes it didn't matter that they were
> amalgamated into a library.
>
> On Feb 3, 2008 3:26 PM, Luis O'Shea <loshea at gmail.com> wrote:
>> I was trying to compile a simple example of OCaml calling C (much
>> like http://caml.inria.fr/pub/docs/manual-ocaml/
>> manual032.html#htoc232). The commands I would like omake to execute
>> are:
>>
>> ocamlc -c foo.mli # (1)
>> ocamlc -c foo_stubs.c # (2)
>> ocamlc -custom -o foobar test_foo.ml foo_stubs.o # (3)
>>
>> What is the best way to get omake to do this (or something similar)?
>>
>> OCamlLibrary(libmysys, mysys) will take care of (1). Is it the best
>> way?
>>
>> StaticCLibrary(foo_stubs, foo_stubs) will take care of (2), although
>> using the C compiler (which requires finding and setting INCLUDES to
>> where the ocaml headers are) rather than via ocamlc.
>>
>> But how do I get the .o file onto the command line in (3) (without
>> using a kludge)?
>>
>> Thanks.
>>
>> _______________________________________________
>> Omake mailing list
>> Omake at metaprl.org
>> https://lists.metaprl.org/mailman/listinfo/omake
>>
>
>
>
> --
> sashan
> http://sashang.orcon.net.nz/
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
More information about the Omake
mailing list