Provides partial support for calling C++ library functions from Julia.
Suppose you have a C++ shared library, libdemo, which contains a function timestwo:
int timestwo(int x) {
return 2*x;
}
double timestwo(double x) {
return 2*x;
}
You can use these functions by placing the @cpp macro prior to a ccall, for example:
mylib = dlopen("libdemo")
x = 3.5
x2 = @cpp ccall(dlsym(mylib, :timestwo), Float64, (Float64,), x)
y = 3
y2 = @cpp ccall(dlsym(mylib, :timestwo), Int, (Int,), y)
The macro performs C++ ABI name-mangling (using the types of the parameters) to determine the correct library symbol.
Like ccall, this performs library calls without overhead. However, currently it has a number of limitations:
The latter three may not be difficult to fix.