[Openmcl-devel] FF call by reference

Ron Garret ron at awun.net
Wed Jul 16 01:06:10 UTC 2008


On Jul 15, 2008, at 4:22 PM, Gary Byers wrote:

>
>
> On Tue, 15 Jul 2008, Ron Garret wrote:
>
>> I'm trying to call an ObjC method that takes a pointer to a pointer  
>> to
>> an ns-error as an argument.  I tried this:
>>
>> ? (rlet ((err (:* ns:ns-error))) (#/foo: thing err)))
>> > Error: Unknown foreign type: NS:NS-ERROR
>
> (rlet ((err (:* #>NSError +null-ptr+))) (#/foo: thing err))
>
> should complain about #/foo being undefined.

You'd think.

? (rlet ((err (:* #>NSError +null-ptr+))) (#/foo: thing err))
 > Error: Extra arguments in (:* :<NSE>RROR +NULL-PTR+) don't match  
lambda list (CCL::TO).

This didn't work either:

? (rlet ((err (:* #>NSError))) (#/foo: thing err))
 > Error: Unknown foreign type: :<NSE>RROR

(FWIW, the actual method I'm trying to call is #/open:)

> Initializing the pointer (err) to a null-pointer isn't strictly
> necessary (in CCL or ObjC), but might be good style: you're allocating
> space (64 or 32 bits) for a pointer, but unless that those bits are
> explicitly initialized they'll just be "whatever was on the stack"
> and unlikely to be meaningful.

I don't think that matters.  It's just an output parameter.

rg




More information about the Openmcl-devel mailing list