[Openmcl-devel] How to access Cocoa objects returned via indirect references (i.e. NSError)

Gary Byers gb at clozure.com
Mon Jul 24 20:35:34 PDT 2006

On Mon, 24 Jul 2006, Phil wrote:

> After calling a method that produces an NSError on failure, I'm not
> clear on how to actually access the NSError.  OpenMCL reports the
> value returned as a mac pointer after the method call so how do I
> access the NSError object it references?
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

I'm not sure that I understand the question, but a "pointer to an
instance of the class NSError" should be identified as and printed
as such (not as a vanilla macptr), and it should be possible to
access it via NSError methods (which are a little baroque ...)

If you're just geting a vanila macptr back ... could you provide
a test case so that this can be reproduced ?

Note that if something's returned by reference, you'd generally
do something like:

  (let* ((ns-error-ptr :id))
    (send some-message ... ns-error-ptr ...)
    (let* ((the-ns-error (pref ns-error-ptr :id)))
      ;; At this point, THE-NS-ERROR should be an NSError (or possibly
      ;; a NULL pointer if there was no error ...

(That's no different from how other things are returned by reference.)

More information about the Openmcl-devel mailing list