grasph/wrapit

choice of `c++` over `julia` ?

Closed this issue · 6 comments

Thanks for this package and the presentation made at https://live.juliacon.org/talk/EA7NVT.

I've successfully wrapped a small portion of my c++ library with wrapit, and it seems promising.

However, I'm questioning the choice of making an executable and write the generating code in c++.
Why not make a julia package out of it ?
This way we can use the Clang_jll artifacts for libclang, and use TOML to easily parse configuration files.

Hello @t-bltg ,

C++ was the natural choice of programming language as the LLVM and Clang libraries the code is based on are themselves implemented C++. The code is mainly using the libclang C API of clang, but few calls to the C++ API are made to circumvent some limitation of libclang. These calls will be eventually removed, when missing features will be added in libclang.

I have actually already considered using the BinaryBuilder to build and distribute the code and I have already a script that runs the build. Here Julia would be introduced only for the purpose of software distribution.

Philippe.

Thanks,

Clang.jl is a popular choice for accessing libclang.

I believe it would be interesting to rewrite CodeTree.cpp, FunctionWrapper.cpp and other source files in julia and use Clang.jl there.

This way, we could auto-generate the c++ code from within a julia package (which we could name WrapIt.jl): it would be easier for integration within the julia ecosystem and also maintenance & versioning since the Clang_jll artifacts are distributed on multiple OSs.

I can work on it, let me know if you might be interested or not.

@t-bltg to save your time, I'd say libclang C API is really bad at this kinda use cases. The limitation of libclang is hard to workaround and finally you will switch back to use the C++ API directly.

To use Clang's C++ API in Julia, you may find https://github.com/Gnimuc/ClangCompiler.jl useful. But I don't have any bandwidth on it at the moment, so it's basically unmaintained.

Thanks @Gnimuc for your very valuable hints and pointing me the right direction.
It think https://github.com/Gnimuc/ClangCompiler.jl is exactly what I'm looking for, looking at it now ...

Concerning WrapIt, t-bltg's question is two-folded:

  1. change of the programming language for the Wrapit implementation;
  2. distribution of wrapit as a julia package.

Let's start with the first point. In my opinion C++ that provides full access to Clang is currently the best choice. So for the moment we will keep C++ as programming language.

Concerning the point 2), I'm interested to learn more on your use case. In particular, do you have specific needs for calling WrapIt from Julia or your intention is to have a convenient way to install WrapIt on your computer?

Philippe.

Thanks for settling point 1.

For point 2, it was more oriented towards convenience, so that a user won't have to build the wrapit tool himself, maybe distributing it as a _jll artifact might be the solution here.

Calling the wrapit tool from within julia might also be useful for a wider adoption, hence a possible lightweight Wrapit.jl julia package.