[cfe-dev] libclang or libtooling for transpiler

Jacob Carlborg via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 29 03:11:54 PDT 2019


On 2019-04-29 12:06, Jacob Carlborg via cfe-dev wrote:

> I've created a tool that does basically the same thing. It generate D 
> bindings to C and Objective-C libraries. This tool is written in D and 
> is using libclang [1]. It's been working for me so far, but I haven't 
> got to the point of trying to translate C++ headers yet.
> 
> This tool is only focusing on generating bindings. That means only the 
> header files are translated, not full C/Objective-C code with function 
> bodies with statements and expressions.
> 
> The current libclang bindings DStep is using are generated with DStep 
> itself. The initial bindings were created by had. It was very easy to 
> do, just some search and replace. libclang contains the most forgiving 
> header files, from this point of view, I have ever seen.
> 
> [1] http://github.com/jacob-carlborg/dstep

Forgot the summary:

I chose libclang because:

* It's a stable API
* It's what's recommend if using other language than C++
* I really, really did not want to use C++. After all, I'm using D, not 
C++ :)

I would say it depends on how much you don't want to use C++. If I were 
you, I would definitely give it a try in Rust.

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list