c++ - How do I identify the correct type parameter with SWIG/OCaml? -


my problem is, have c++ library need access within ocaml, , believe having difficulty working uniformly homogenous type of generated interfaces.

i getting following error:

(failure "no appropriate conversion found.") ... raised primitive operation @ file... 

i found exactly occurs, , appears pointer argument.

i using c++ library libdai have upgraded have more recent swig bindings works on osx, along ocaml, oasis , opam. in ocaml, i'm trying create vector , push instance it, , done in ocaml_swig/src/test.ml, here. replicate, clone branch of opam-repository, , pin folder with:

cd packages/libdai/libdai.1.0.0/ && opam pin add libdai ./ -y 

or, alternatively build dockerfile available at

packages/libdai/libdai.1.0.0/dockerfile 

just mark out part particular image start from, pick ubuntu:16.04 or something, , specify user have in yours. it's not long dockerfile @ all, should easy, , i've tested myself too.

this should correctly fail during build when running test.native file gets generated ocaml_swig under packages/libdai/libdai.1.0.0/ocaml_swig. binary tends put here: packages.dev/libdai/ocaml_swig/test.native, can run manually too.

edit

one thing that, vecobservation declared vector of observation, not pointers observation. don't know new_observation corresponds in c portion, since ocaml types see homogenous swig types. can't dereference ocaml instance have according c semantics in order hand off, either. i'm not sure how move forward if case.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -