[Rubycocoa-devel 382] libffi experiment

Back to archive index

Laurent Sansonetti lsans****@apple*****
Wed Sep 13 03:36:32 JST 2006


Hi guys,

As you could see, I recently experimented the libffi library inside  
RubyCocoa. I did that in a branch named "libffi-experiment" in the SVN  
repository. I also experimented a new metadata XML mechanism.

Here are the major changes in that branch:

- libffi sources are included in misc/libffi, and built if libffi is  
not present in the system
- no more rb_[AppKit|Foundation].c code generation
- at build time, framework/tool/generate_bridge_support.rb parse  
AppKit/Foundation headers and generate XML description for constants,  
functions, enumerations...
- at runtime, RubyCocoa parses the XML files and do the necessary  
linkage
- constants are loaded lazily (via OSX.const_missing), to avoid  
localizing all symbols at once (which is costly)
- libffi is used to call C functions from Ruby
- libffi is used to forward messages from Ruby to ObjC
- the XML description also contains the list of ObjC methods returning  
BOOL, so that we can automatically convert their return value to real  
Ruby boolean objects (so, not necessary to suffix with ? anymore to  
have a bool value)

Most tests are passing (and all the samples I tested are working). The  
only stuff that is broken is the pass-by-reference support, which is  
normal.

I'm right now working on describing structures inside the XML (for  
example, in case of Foundation, NSRect and friends), so that  
everything can be handled dynamically.

Please test the branch if you can, and report me any feedback. If it's  
OK for everyone I would propose to merge it to trunk once everything  
is complete.

Thanks,
Laurent



More information about the Rubycocoa-devel mailing list
Back to archive index