Clang.jl ignoring #define starting with underscore

Iulian.Cioarca
Wed, 29 Apr 2020 14:13:15 +0000
General Usage

I have some header files which I’d like to wrap with Clang.jl.
Why does it ignore definitions starting with underscore such as:
#define _VAR (1)
If I remove the underscore, it works fine:
#define VAR (1)
const VAR = 1

The code used:

using Clang

const INCLUDE_PATH = pwd()
const HEADERS_PATH = [joinpath(INCLUDE_PATH, header) for header in readdir(INCLUDE_PATH) if endswith(header, ".h")]

wc = init(; headers = HEADERS_PATH,
            output_file = joinpath(@__DIR__, "test_api.jl"),
            common_file = joinpath(@__DIR__, "test_common.jl"),
            clang_includes = vcat(INCLUDE_PATH, CLANG_INCLUDE),
            clang_args = ["-I", joinpath(INCLUDE_PATH, "..")],
            header_wrapped = (root, current)->root == current,
            header_library = x->"libtest",
            clang_diagnostics = true,
            )

run(wc)

One can test by simply creating a .h file with #define _VAR (1)

3 posts - 2 participants