Class: ObjC::Function
ObjC::Function wraps C functions for manipulation from Ruby.
Public Class methods
wrap (p1, p2, p3)
Wrap a C function with a given name p1 so that it can be called from Ruby with the specified return type p2 and arguments p3. The return type and argument types are described with Objective-C type encodings. The argument types are passed in a Ruby array of strings.
For example, to wrap the C function
int NSApplicationMain(int argc, char *argv[])
you would use the following in Ruby:
f = ObjC::Function.wrap('NSApplicationMain', 'i', %w{i ^*})
You could then call it with
f.call(0, [])
Alternately, you could first install it in a module:
f >> ObjC
and then call it like this:
ObjC.NSApplicationMain(0, [])