# Clang.jl on a Header with Function Overloading

**URL:** <https://discourse.julialang.org/t/clang-jl-on-a-header-with-function-overloading/128083>\
**Category:** General Usage\
**Tags:** clang\
**Created:** [April 15, 2025, 2:57am UTC](https://discourse.julialang.org/t/clang-jl-on-a-header-with-function-overloading/128083 "2025-04-15T02:57:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke-kiernan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luke-kiernan/32/214309_2.png) [@luke-kiernan](https://discourse.julialang.org/u/luke-kiernan)\
**Post date:** [April 15, 2025, 2:57am UTC](https://discourse.julialang.org/t/clang-jl-on-a-header-with-function-overloading/128083/1 "2025-04-15T02:57:53Z")

</div>

Is it possible to use `Clang.jl` to parse a header that uses the [overloadable](https://clang.llvm.org/docs/AttributeReference.html#overloadable) attribute? When I try, it only parses the first function with each name. Here’s my build setup: you’ll have to be on an Apple Silicon Mac to run this, though. (My goal is to automate the generation of Julia wrappers for Apple Accelerate libraries, instead of writing them by hand like I did [here](https://github.com/JuliaLinearAlgebra/AppleAccelerate.jl/blob/libSparse/src/libSparse/wrappers.jl#L221).)

```julia
using Clang.Generators
using Clang.LibClang.Clang_jll

cd(@ __DIR__ )

include_dir = normpath(Clang_jll.artifact_dir, "include")
options = load_options(joinpath(@ __DIR__ , "generator.toml"))
args = get_default_args()
push!(args, "-I$include_dir")
# may need to replace MacOSX15.sdk with a different version number.
headers = ["/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/System/Library/"*
            "Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework"*
            "/Versions/A/Headers/Sparse/Solve.h"]
ctx = create_context(headers, args, options)
build!(ctx)

```

[generator.toml](https://discourse.julialang.org/uploads/short-url/5RTM4Ip4HStiWmNxtA89zz7Tfst.toml) (8.6 KB)  
I may open an issue on the GitHub repo as well: naively, it seems like it shouldn’t be too hard to add as a feature.

Edit: for a simple MWE, the `tgsin` code snippet in the clang docs works just fine. Copy-paste that into a `.h` file and build a Julia library from it, using the default `generator.toml`: you only get a single function definition, for `tgsin(x::Cfloat)`.
