From: gga Date: 2005-01-29T03:25:52+09:00 Subject: SWIG: ruby proc->c function pointer Sorry for the slightly off-topic question. I am starting to use swig to wrap some C++ library for ruby for the first time. In the process of doing so, I realize I will need to pass proc objects from ruby and turn them into function pointers in C, so as to provide a callback mechanism. I understand this can potentially be done with typemaps, but I am not sure exactly how. I only need to have a single callback per class, so I was thinking of storing the ruby callback within the class itself and then have a common C wrap function that would map the C callback to the appropiate ruby callbacks (ie. proc object) based on what was stored in the class. I was also unsure if SWIG already provides some auxiliary functions for doing something similar. Does anyone have any pointers? I'm already familiar with how ruby-fltk handles this, for example, and I want to basically emulate something akin within the SWIG meta-language. I'm looking at FXRuby but the code is a tad too complex for a SWIG newbie.