From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-06-06T01:19:41+09:00 Subject: Re: Ruby-SWIG question: wrapping function objects with blocks On Thu, 05 Jun 2003 17:07:03 +0200, Christian Szegedy wrote: > In out project, there are a lot of functions which > take a function object parameter (Apply) > and call then may call the call method of this > object. I would like to wrap it with a Ruby code > which takes a block and the creates a new apply > object whose call function calls the block. Do you want something like this ? /* * within C. */ void my_c_function(HOOK hook) { printf("1\n"); hook(); printf("3\n"); } # # within Ruby. # def my_super_hook puts "2" end If I understand you correct you want to supply 'my_super_hook' to 'my_c_funtion'. Am I right ? It is possible.. But I don't know how to exactly do this. I am working on a tutorial about callback between C++ and Ruby, which may have your interest. http://metaeditor.sf.net/embed/ -- Simon Strandgaard