Clang.jl ignoring #define starting with underscore

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)

Identifiers with a leading underscore are reserved, so we ignore them intentionally: https://github.com/JuliaInterop/Clang.jl/blob/5971591cd4bf0d8b128da3d8cb7a2649f6c2e665/src/wrap_c.jl#L395

1 Like

Thank you for the quick reply and explanation! I managed to solve this by a small manual edit of the file. It was used as a constant which was added to other constants in the header (error codes)