Hello,

are anyone using CxxWrap.jl library? I am trying to figure out a way to 
pass array to the function. So far I have came up to to this nonworking 
(makes julia to crash) code
#include <string>
#include <cxx_wrap.hpp>


std::string greet(float * mem)
{
   return "hello, world";
}


JULIA_CPP_MODULE_BEGIN(registry)
  cxx_wrap::Module& hello = registry.create_module("Hello");
  hello.method("greet", &greet);
JULIA_CPP_MODULE_END
which is compiled with makefile
all: code

JULIA_DIR = $(shell which julia)
IJULIA = $(shell dirname $(shell dirname $(JULIA_DIR)))/include/julia
ICxxWrap = $(shell julia -e 
'print(Pkg.dir("CxxWrap","deps","usr","include"))')
LDIR=$(shell julia -e 'print(Pkg.dir("CxxWrap","deps","usr","lib"))')

LIBS = -lcxx_wrap -ljulia
CFLAGS=-I$(IJULIA) -I$(ICxxWrap) -L$(LDIR)

code: code.cpp
 g++ code.cpp -fPIC -std=c++11 -lcxx_wrap -shared -o libhello.so $(CFLAGS)
and eventually interfaced with
using CxxWrap
wrap_modules(joinpath(".","libhello"))
@show Hello.greet()

My small project needs to interface one function which takes a structures. 
These stores pointers to arrays and other parameters which I would like to 
set up in julia. So I also need to understand understand how to set and get 
values from interfaced structs for example DoubleData from 
https://github.com/barche/CxxWrap.jl/blob/master/deps/src/examples/types.cpp. 
 

Reply via email to