Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call C++ Hello World from Julia

Tags:

c++

julia

I have a C++ program that parses a binary file and outputs a std::string. I would like to call this function directly from Julia and convert the steam into a DataFrame. I need it to work in Linux and Windows. Currently, I have the program write the output to a text file, and then I read it into Julia. Cxx is no longer supported, and trying to get CxxWrap to work has been an exercise in frustration.

Toy Problem: If someone could show me how to call the code below from Julia, that would be awesome.

// the example from https://github.com/JuliaInterop/CxxWrap.jl
#include <string>
std::string greet()
{
 return "hello, world";
}
like image 860
njspeer Avatar asked Nov 06 '22 23:11

njspeer


1 Answers

There's a new package which might fit your needs here:

https://github.com/eschnett/CxxInterface.jl

It is intended as a successor to Cxx.jl and more stable, so I'd recommend giving it ago although I haven't tried it myself!

like image 69
Nils Gudat Avatar answered Jan 02 '23 08:01

Nils Gudat