Wrapping typedef enum with Clang.jl

samuelpowell
Mon, 12 Nov 2018 08:17:48 +0000
General Usage

If I try to wrap the following header:

typedef enum _foo {
  BAR,
  BAZ
} foo;

using the following Clang.jl script:

using Clang.wrap_c

const context = wrap_c.init(
    headers = [joinpath(@__DIR__, "header.h")],
    common_file = joinpath(@__DIR__, "wrapper.jl"),
    clang_diagnostics = true,
)

run(context)

I get the following wrapper:

# begin enum _foo
const _foo = UInt32
const BAR = 0 |> UInt32
const BAZ = 1 |> UInt32
# end enum _foo

const foo = Cvoid

I was expecting that the typedef name const foo = UInt32. Functions generated as part of this wrapper which should return an integer will instead return nothing.

Do I need to configure the wrapping process differently, or is there a problem processing typedefs?

12 posts - 2 participants