Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

Install C headers for C library

$
0
0

Hello,

In my setup, I have Coq extract to OCaml which I then compile as a C library with the following setup:

(coq.extraction
 (prelude bitflip)
 (extracted_modules bitflip))

(executable
 (name CAPI)
 (foreign_stubs (language c)
                (names cstub))
 (flags :standard -linkall)
 (modes (native shared_object))
 (modules bitflip CAPI))

(install
 (section lib)
 (files
  (CAPI.so as libbitflip.so)
  (cstub.h as bitflip.h)))

The directory tree is

dune-project
src
├─ bitflip.v
├─ CAPI.ml
├─ cstub.c
├─ cstub.h
├─ dune

I’m new to OCaml, opam, and dune and it’s hard for me to understand everything that is going on. In any case, my problem is that the install stanza sends bitflip.h to /usr/local/lib/bitflip.h which is obviously the wrong directory for it to be in.

The advice on the stanza reference is to use public_headers to install C headers, but that is for a library stanza. However, what I found for creating a shared library was using the executable stanza with (modes (shared_object)).

I would appreciate advice on this.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles