[MacRuby-devel] pointer to a pointer

John Shea johnmacshea at gmail.com
Mon Dec 1 00:29:09 PST 2008


Hi Yehuda,

Laurent kindly responded to a similar query from me :

His reply (Novemebr 24th):

> In order to use these methods I introduced in trunk a class named  
> Pointer. You allocate a Pointer object by using the #new_with_type  
> method in which you pass the Objective-C type encoding.  @ is for  
> pointers, i for integers, d for doubles, etc...
>
> # This is not very intuitive, I will implement the RubyCocoa way to  
> deal with pointers as well.
>
> You use it like that:
>
>     errorp = Pointer.new_with_type('@')
>    urlData = NSURLConnection.sendSynchronousRequest(urlRequest,  
> returningResponse:response, error:errorp)
>    if urlData.nil?
>      error = errorp[0]
>      puts "error: #{error.description}"
>   end


With trunk of last week it worked fine for me with:

     errorp = Pointer.new_with_type('@')
     response = Pointer.new_with_type("@")

     urlData = NSURLConnection.sendSynchronousRequest(urlRequest,  
returningResponse:response, error:errorp)

Hope that helps,
cheers,
J




On Dec 1, 2008, at 8:30 , Yehuda Katz wrote:

> I'm trying to figure out a way to make an NSError** object that is a  
> required parameter to the PSFeed#refresh: method. What's the correct  
> mechanism?
>
> -- 
> Yehuda Katz
> Developer | Engine Yard
> (ph) 718.877.1325
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20081201/d1d0b8be/attachment.html>


More information about the MacRuby-devel mailing list