[Openmcl-devel] Objective-C interface type declaration

Gary Byers gb at clozure.com
Tue Jun 18 11:43:19 PDT 2002


For a method arglist, ENCODE-OBJC-METHOD-ARGLIST (defined in
"ccl:examples;apple-objc.lisp") seems to do a fairly good job.
It calls ENCODE-OBJC-ARG-TYPE, which is also used to encode
the argument types of instance variables.  (I believe that
instance variables need to get encoded a bit differently
than arguments do.)

One limitation of ENCODE-OBJC-ARG-TYPE is that it'll encode
something like (* :<NSS>tring) as "^" (a generic pointer);
since NSString's are subtypes of NSObjects, the pointer should
really be encoded as "@".  I suppose that this means that
any structure whoses first field is called "isa" and whose
first field is a pointer to an objc-object should be considered
an NSObject, unless someone knows of a better way.

Note that DEFINE-OBJC-METHOD calls ENCODE-OBJC-METHOD-ARGLIST.

Apple's "otool" command can be used (with -o -v arguments) to dump
the Objective-C contents of a .o file; this information includes
the "method_type" strings as encoded by the C compiler.  I think
that in all cases in the demo source files lisp generates the same
type string that C would have.

AFAIK, the encoded type information is only used when dealing with
distributed objects; if that's true, it's probably OK to be "close
enough" until people start dealing with DO.

On Tue, 18 Jun 2002, Brian Campbell wrote:

> I've noticed in the Cocoa example that there are strings
> containing Objective-C type information for methods that are
> defined. How do you get these strings? Is there any way to
> automatically compute them?
>
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel
>
>


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list