Answer the question
In order to leave comments, you need to log in
Pass Ruby block as argument to CXX-extension?
It is necessary to declare a method in CXX-extension that would accept a Ruby block (in order to track the progress of the task). I use RICE binders .
Here is a class method in C++:
String PieceMaker::makeHash(void onProgress(int, int));
pm.make_hash do |done, total|
# code goes here
end
/home/kkremen/.rvm/gems/ruby-2.5.1/gems/rice-2.1.2/ruby/lib/include/rice/detail/../detail/Caster.hpp:36:54: error: invalid static_cast from type ‘void*’ to type ‘void (*)(int, int)’
Derived_T * d(static_cast<Derived_T *>(derived));
^
/home/kkremen/.rvm/gems/ruby-2.5.1/gems/rice-2.1.2/ruby/lib/include/rice/detail/../detail/Caster.hpp:37:37: error: invalid static_cast from type ‘void (*)(int, int)’ to type ‘void*’
return static_cast<Base_T *>(d);
^
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question