8000 [ctypes] try to build ctypes foreign stubs the same way as regular foreign stubs (closes #5809) by mbacarella · Pull Request #5816 · ocaml/dune · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[ctypes] try to build ctypes foreign stubs the same way as regular foreign stubs (closes #5809) #5816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Unreleased
- Ignore `bigarray` in `(libraries)` with OCaml >= 5.0. (#5526, fixes #5494,
@moyodiallo)

- Start with :standard when building the ctypes generated foreign stubs so that
we include important compiler flags, such as -fPIC (#5816, fixes #5809).

3.2.0 (17-05-2022)
------------------

Expand Down
16 changes: 10 additions & 6 deletions src/dune_rules/ctypes_stubs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ let libraries_needed_for_ctypes ~loc =

let add ~loc ~parsing_context ~external_library_name ~add_stubs ~functor_
~instance ~foreign_stubs =
let pos = ("", 0, 0, 0) in
let flags =
let cflags_sexp_include =
Ordered_set_lang.Unexpanded.include_single ~context:parsing_context ~pos
(cflags_sexp ~external_library_name)
in
Ordered_set_lang.Unexpanded.concat ~context:parsing_context ~pos
Ordered_set_lang.Unexpanded.standard cflags_sexp_include
in
add_stubs Foreign_language.C ~loc
~names:
(Some
(Ordered_set_lang.of_atoms ~loc
[ c_generated_functions_cout_no_ext ~external_library_name ~functor_
~instance
]))
~flags:
(Some
(Ordered_set_lang.Unexpanded.include_single ~context:parsing_context
~pos:("", 0, 0, 0)
(cflags_sexp ~external_library_name)))
foreign_stubs
~flags:(Some flags) foreign_stubs
3 changes: 3 additions & 0 deletions src/dune_rules/ordered_set_lang.ml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ module Unexpanded = struct
; context
}

let concat ~context ~pos a b =
{ ast = Ast.Union [ a.ast; b.ast ]; loc = Some (Loc.of_pos pos); context }

let field ?check name =
let decode =
match check with
Expand Down
2 changes: 2 additions & 0 deletions src/dune_rules/ordered_set_lang.mli
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ module Unexpanded : sig
val include_single :
context:Univ_map.t -> pos:string * int * int * int -> string -> t

val concat : context:Univ_map.t -> pos:string * int * int * int -> t -> t -> t

val field :
?check:unit Dune_lang.Decoder.t
-> string
Expand Down
0