Skip to content

jw3126/CxxCall.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.