[Openmcl-devel] Specifying data types for calls via the Obj-C bridge with a variable number of arguments

Gary Byers gb at clozure.com
Fri Apr 27 22:59:04 PDT 2007


(objc:send (objc:@class "NSString") :string-with-format #@"Testing: %@" (:id #@"one two three four"))

(objc:send (objc:@class "NSString") :string-with-format #@"Testing: %@" (:address #@"one two three four"))

With SEND, it's necessary to use parens to delimit the foreign-type-keyword/
arg pairs for all non-required arguments; otherwise, SEND might interpret
the foreign type keywords as part of the message name.

Or

(#/stringWithFormat: ns:ns-string #@"Testing: %@" #@"one two three four")

In the latter case. the foreign type is determined by the type of the
lisp argument (integers are passed as integers, floats as floats,
pointers as pointers.)


On Sat, 28 Apr 2007, Phil wrote:

> I'm not having much luck in specifying the required data types for
> methods that accept vargs... any pointers on specifying the valid
> types are appreciated.
>
> (objc:send (objc:@class "NSString") "stringWithFormat:" #@"Testing: %
> d" (:integer 1)) ; Seems simple enough
>
> (objc:send (objc:@class "NSString") "stringWithFormat:" #@"Testing: %
> s" (:string "string")) ; OK, maybe not
>
> (objc:send (objc:@class "NSString") "stringWithFormat:" #@"Testing: %
> @" (??? #@"string")) ; No idea
>
> Thanks,
> Phil
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list