[MacRuby-devel] Pointers for BOOL types

Dr Nic Williams drnicwilliams at gmail.com
Thu Jan 1 13:55:30 PST 2009


The following method takes a ptr->BOOL. I've played around but cannot
figure out how to create a pointer to a true/false that then returns
true/false via its accessor.

- (BOOL)fileExistsAtPath:(NSString *)path isDirectory:(BOOL *)isDirectory

The following doesn't work:

framework 'Cocoa'
p1 = Pointer.new_with_type('@')
p1.assign(false)
p1[0] == false # => false, but should be true

Then I figured I should be able to pass BOOL to -new_with_type as it
is the data type, but BOOL isn't recognised.

Perhaps test_objc.rb could include some more examples/coverage of
Pointer usage too?

-- 
Dr Nic Williams
iPhone and Rails consultants - http://mocra.com
Fun with iPhone/Ruby/Rails/Javascript - http://drnicwilliams.com
* Surf Report for iPhone - http://mocra.com/projects/surfreport/ *


More information about the MacRuby-devel mailing list