> 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.The type for bool is upper case B. If you replace @ with B in your example it works fine. Just a little warning about pointers: they tend to forget their type if you read the value returned by a function twice. Do not try to read more than once their value (just store the value returned by #[] in a Ruby variable). However, reusing the same pointer in multiple calls seems to work fine. For example the following code: # rects was retuned by NSLayoutManager#rectArrayForCharacterRange puts rects[0] puts rects[0] Displays: #<NSRect origin=#<NSPoint x=5.0 y=0.0> size=#<NSSize width=0.0 height=19.0>> xxxxx.rb:222:in `[]': unrecognized octype `?_?' (RuntimeError) _______________________________________________ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
