Calling Boost from Ruby via SWIG?

Suppose I want to call one or more functions of a buffer library from Ruby code. There are many examples of the times when I want to do this, but recently I want to use the Boost Graph library to efficiently process a graph. I think the most frequently suggested way to use SWIG is for this. Has anyone gone through and created SWIG wrappers for the Boost library? Is this really the best way to interact with Boost? Which parts of Boost cannot be accessed through SWIG because they need unsupported C ++ functions?

+3
source share
1 answer

I can’t say that I created wrappers for Boost libraries on purpose, but I did it for my own template classes.

This is great if you remember that SWIG will wrap specific instances of templates using the directive %template.

As stated in the documentation above:

[...] ++ - runnable object-code, SWIG . , , SWIG (, vector<int>, array<double> ..). -, , vector<int>, . , , intvector.

intvector :

%template(intvector) vector<int>;
0

Source: https://habr.com/ru/post/1774872/


All Articles