Generating C code interface from CPP using clang libtooling
C++ CMake
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is simple tool to generate a C interface from C++ source code using clang libtooling. CPP2C currently is a proof of concept, and only applies to, to generate the C interface. The code is explained in details in this blog post.

Building and Installation

git clone
cd CPP2C
mkdir build
cmake ..
sudo make install

Run it over uThreads source code

git clone
cd uThreads
cpp2c include/uThreads.h -- -I./src -I/usr/include/x86_64-linux-gnu/c++/5/ -I/usr/include/c++/5.4.0 -std=c++11


You can find the output in outpu folder: cwrapper.h is the header that should be included in C files, and cwrapper.cpp is in C++ and is responsible to convert C++ pointers to C and vice versa.