jeanp****@gmail*****
jeanp****@gmail*****
Fri Jan 5 08:13:32 JST 2007
hi hi - continuing on from my earlier investigations posted to the rubycocoa-talk list, i installed rubycocoa 0.9 from source and gave it a whirl. i've run into a few oddities that i thought i'd ask about. [1] for some reason, i can't seem to compile objC code into a bundle and require it in ruby *unless* i name the bundle client.bundle. i have attached a little sample project, if you run rake it'll build 'client.bundle' from the provided source and if you run helper.rb it'll just print out a quick debug line after requiring the built bundle. strangely enough, if i name the bundle something other than 'client.bundle' and require it in helper.rb, it gives me a load error on the require: LoadError: Failed to lookup Init function ./schoolkid.bundle exactly the same code, just using a different bundle name... [2] is rubycocoa doing some sort of memory management on allocated objC objects? i thought with 0.5 that if i allocated and initialized an objC derived object that i'd also need to release it, but with 0.9, doing so causes a segfault. kid = OSX::SchoolKid.alloc.init kid.release /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/oc_import.rb:170: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [i686-darwin8.8.1] when running rubycocoa from irb and alloc/init'ing objects then releasing them, i get a bus error: /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/oc_wrapper.rb:46: [BUG] Bus Error ruby 1.8.5 (2006-08-25) [i686-darwin8.8.1] zsh: abort irb [3] should i be able to override objC methods in ruby? if i have some objC class: @interface SchoolKid : NSObject { } - (NSString *)saySomething; @end @implementation SchoolKid - (NSString *)saySomething { return @"sorry, I am quiet"; } @end and try to reopen the class in ruby to override a method, nothing happens: class OSX::SchoolKid def saySomething puts "hi" end end but i can subclass and override: class OtherKid < OSX::SchoolKid def saySomething puts "halllo" end end ns_overrides seems to have disappeared, is there a proper way to do this? (i'm trying to mock objC objects in ruby). [4] is OSX.ns_import no longer required? thats all for now =) thanks for any help that can be provided! cheers, jean-pierre -------------- next part -------------- An HTML attachment was scrubbed... Download -------------- next part -------------- A non-text attachment was scrubbed... Name: helper.rb Type: application/octet-stream Size: 390 bytes Desc: not available Url : http://lists.sourceforge.jp/mailman/archives/rubycocoa-devel/attachments/20070104/4696138f/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Rakefile Type: application/octet-stream Size: 255 bytes Desc: not available Url : http://lists.sourceforge.jp/mailman/archives/rubycocoa-devel/attachments/20070104/4696138f/attachment-0001.obj -------------- next part -------------- #import <Cocoa/Cocoa.h> @interface SchoolKid : NSObject { } - (NSString *)saySomething; @end -------------- next part -------------- A non-text attachment was scrubbed... Name: SchoolKid.m Type: application/octet-stream Size: 239 bytes Desc: not available Url : http://lists.sourceforge.jp/mailman/archives/rubycocoa-devel/attachments/20070104/4696138f/attachment-0002.obj