From: yermej Date: 2008-01-25T03:45:00+09:00 Subject: Re: Using a DLL that wants a function pointer On Jan 24, 9:10 am, daniel åkerud wrote: > [Note: parts of this message were removed to make it a legal post.] > > I want to use a DLL with Ruby (Win32). This DLL has X number of functions, > and one of these takes a function pointer. The DLL will call this > callback-function when some data arrives. I cannot figure out how to do this > in Ruby. Is it possible? If not, any tips on how to circumvent this > restriction? _Any_ hints appreciated. > > /D I haven't tried it before, but look into Win32::API::Callback. Most of my googling returned threads where people were having problems with it, but that might give you examples to get started with. Here's one of them: http://rubyforge.org/pipermail/win32utils-devel/2008-January/000985.html Look for where SNMPAPI_CALLBACK is defined. It appears that Callback takes two arguments - the first is the parameter signature notated the same as when you use an API method. The second would be the return signature. Following that is the body of the callback as a block.