[Openmcl-devel] How do I make a cocoa method that returns a float

Anders Conradi beque at telia.com
Mon Feb 21 07:31:25 UTC 2005


Hi,

How do I implement cocoa methods that return floats? I thought
(ccl::define-objc-method ((:single-float fv) myclass) ...)
would work, but it doesn't. This is what I get if I try it at the repl:

Welcome to OpenMCL Version (Beta: Darwin) 0.14.2-p1!
? (require :cocoa)
:COCOA
("FAKE-CFBUNDLE-PATH" "SPLAY-TREE" "NAME-TRANSLATION" 
"PROCESS-OBJC-MODULES" "OBJC-CLOS" "OBJC-RUNTIME" "BRIDGE" 
"OBJC-SUPPORT" "COCOA-WINDOW" "COCOA-EDITOR" "PTY" "COCOA-LISTENER" 
"COCOA")
? (defclass myclass (ns:ns-object) () (:metaclass ns:+ns-object))
#<OBJC:OBJC-CLASS MYCLASS (#xA0900)>
? (ccl::define-objc-method ((:single-float fv) myclass)
   5.0s0)
|-[Myclass fv]|
? (defvar mo (make-instance 'myclass))
MO
? (ccl::send mo 'fv)
10.0

I am sure I am overlooking something obvious, but the solution eludes 
me.
Thanks for any help!
// Anders




More information about the Openmcl-devel mailing list