JuliaInterop / libcxxwrap-julia

C++ library for backing CxxWrap.jl
Other
85 stars 43 forks source link

Can we make libcxxwrap-julia a header-only library? #104

Closed metab0t closed 2 years ago

metab0t commented 2 years ago

I an wondering whether we can make libcxxwrap-julia a header-only library just like pybind11. The cpp files only contain ~700 lines of code.

Header-only library will make it easier to distribute and maybe we can get rid of libcxxwrap_julia_jll?

$ tokei include src
===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 C++                     4          807          686            7          114
 C++ Header             11         3821         3092          147          582
===============================================================================
 Total                  15         4628         3778          154          696
===============================================================================
barche commented 2 years ago

Unfortunately this is not possible (as far as I can tell) because we use functionality from the Julia runtime in libjulia, so linking against that is needed. Also the STL part compiles in a series of predefined types, it would be hard to consolidate these lists if each wrapped library defined its own list. Although that would be better if it could be made to work.

metab0t commented 2 years ago

Thanks for explanation! There are some shared components that should live in libcxxwrap_julia, including global module registry and type mapping.