CxxCall.jl

Simple stupid C++ interop
Author jw3126
Popularity
23 Stars
Updated Last
1 Year Ago
Started In
December 2021

CxxCall

Stable Dev Build Status Coverage

CxxCall allows calling C++ code from Julia:

using CxxCall
...
@cxx mylib function add(x::Cint, y::Cint)::Cfloat
    """
    float ret = x + y;
    std::cout << "Welcome to libAddCxx" << std::endl;
    std::cout << "x=" << x << " y=" << y << " ret=" << ret << std::endl;
    return ret;
    """
end
...

For complete examples check out the tests.

Acknowledgements

Alternatives

  • Cxx.jl allows to mix julia and C++ code. It is an amazing proof of concept, but notoriously hard to maintain.
  • CxxWrap.jl is probably the most mature option. The user specifies the wrapping on the C++ side.
  • CxxInterface.jl. Wrappers are specified on the julia side using string manipulation. Compared to the above alternatives, this approach is very simple.
  • Base.ccall. Writing a C-API and calling it manually using ccall is always an option. If templates are involved the amount of code becomes unwieldy quickly however.

Required Packages

Used By Packages

No packages found.