PackageCompiler.jl and default header file creation

First time using package compiler to make a shared c library of julia functions for use in a larger C and C++ project.

Initially I was thinking that the compile_library function would be able to see all of the fancy @ccallable macros and make an appropriate header file for the library it just created.

Is there a reason why this isn’t done?

Something like this:

open("julia_mylib.h","w") do io
    println(io,"#include \"julia.h\"")
    println(io)
    open("../src/mylib_ccall_interface.jl") do f
        for ln in eachline(f)
            if occursin("Base.@ccallable",ln)
                rxp=r"^(?<comment>#?)Base.@ccallable(?: function)? (?<fncname>.*)\((?<vars>.*)\)::C(?<returnType>\w*)" 
                gotcha=match(rxp,ln)
                if !isnothing(gotcha)
                    # parse the variables
                    if length(gotcha[:vars])>0
                        vars=[ replace(var,r"(?<name>\w+)::Cstring"=>s"char *\g<name>",
                                           r"(?<name>\w+)::C(?<type>\w+)"=>s"\g<type> \g<name>",
                                           r"(?<name>\w+)::Ptr{C(?<type>\w+)}"=>s"\g<type> *\g<name>")
                                for var = split(gotcha[:vars],",")]
                        vartext=join(vars,", ")
                    else
                        vartext="void"
                    end
                    println(io,"$(gotcha[:returnType]) $(gotcha[:fncname])($(vartext));")
                end
            end
        end
    end
end

I’m sure it doesn’t cover every case.