[cl-objc-devel] cl-objc-leopard patch and NSString bug?
Leigh Smith
leigh at leighsmith.com
Fri Feb 20 09:22:45 UTC 2009
Ok, I'm answering my own question because it was rather silly in the
first place and because of the incredible amount of response I got :-)
The code below crashes:
(in-package :cl-objc)
(setf pool (invoke 'ns-autorelease-pool alloc))
(invoke pool init)
(setf my-string (invoke 'ns-string alloc))
(invoke my-string :init-with-utf8-string "blah blah")
(invoke my-string utf8-string)
Because, subtly, my-string assigned by alloc is different to what init-
with-utf8-string returns. So I should have done:
(setf my-string (invoke (invoke 'ns-string alloc) :init-with-utf8-
string "blah blah"))
(invoke my-string utf8-string)
So using the result returned by :init-with-utf8-string then works
fine, and I'm happy. Hope this helps someone.
P.S. You will still need the patch I enclosed in the previous post to
be able to build cl-objc, however.
Leigh
--
Leigh M. Smith
mailto:leigh at leighsmith.com
http://www.leighsmith.com
skype:aussieleighsmith
More information about the Cl-objc-devel
mailing list