Lisp HUG Maillist Archive

Objective-c : argument by reference ?

LWM 5.1.2

Hello list,

How can I implement the type (id *) with the objc package ? Is it possible ?
I have a cocoa method that passes arguments by reference and I really don't
know how to return these arguments... The :pointer type doesn't help because
it doesn't compile ("No support for encoding type :POINTER currently").

Any idea ?

Thanks in advance

Denis


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgium

Tel : 32 (0)2 219 31 09
Email :  denis.pousseur@gmail.com
Website : http://www.denispousseur.com
-------------------------------------------------------



Re: Objective-c : argument by reference ?

Well, this seems to work :

1) Declare arg as a normal objc-object-pointer

2) set the value of the pointer :
(setf (dereference arg :type 'objc-object-pointer) my-objc-object)

Sorry for the noise...

Denis

Le 24/05/11 19:58, « [NOM] » <[ADRESSE]> a écrit :

> 
> LWM 5.1.2
> 
> Hello list,
> 
> How can I implement the type (id *) with the objc package ? Is it possible ?
> I have a cocoa method that passes arguments by reference and I really don't
> know how to return these arguments... The :pointer type doesn't help because
> it doesn't compile ("No support for encoding type :POINTER currently").
> 
> Any idea ?
> 
> Thanks in advance
> 
> Denis
> 
> 
> -------------------------------------------------------
> Denis Pousseur
> 70 rue de Wansijn
> 1180 Bruxelles, Belgium
> 
> Tel : 32 (0)2 219 31 09
> Email :  denis.pousseur@gmail.com
> Website : http://www.denispousseur.com
> -------------------------------------------------------
> 
> 

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgium

Tel : 32 (0)2 219 31 09
Email :  denis.pousseur@gmail.com
Website : http://www.denispousseur.com
-------------------------------------------------------



Re: Objective-c : argument by reference ?


On May 24, 2011, at 1:58 PM, Denis Pousseur wrote:

> I have a cocoa method that passes arguments by reference and I really don't
> know how to return these arguments

??
When you pass arguments by reference you don't generally return those arguments - you use the reference to mutate the object referred to by the reference and often don't return anything (i.e., return type is void).

If you're trying to get at the thing pointed to by a pointer then fli:dereference might be what you want...

Why don't you post your code so we can get an idea of what you're trying to do.

warmest regards,

Ralph


Raffael Cavallaro
raffaelcavallaro@me.com






Updated at: 2020-12-10 08:37 UTC