Lisp HUG Maillist Archive

Objective-C and coercing return value of existing methods

Folks,

I'm trying to work with the bitmapData method of Cocoa's
NSBitmapImageRep. The method is specified as

- (unsigned char *)bitmapData

and when I try to invoke it I get the following error:

CL-USER 21 : 2 > (objc:invoke bitmap "bitmapData")

Error: External format :ASCII got error reading #<Pointer to type
(:UNSIGNED :CHAR) = #x051B9000> at position 2: Non-ASCII code 181.

I need the return value to stay a foreign pointer so that I could, for
example, copy the bytes into a foreign byte array. How do I prevent
that pointer from being dereferenced?

    Thanks, Joel

-- 
http://wagerlabs.com/ 
New generation of poker room software


Re: Objective-C and coercing return value of existing methods

According to the good folks at LispWorks support...

The form to use here is:

(objc:invoke-into '(:pointer (:unsigned :char))
                 bitmap
                 "bitmapData")

This will return an FLI pointer, which is suitable for passing to other
FLI/ObjC calls that expect unsigned char *.

-- 
http://wagerlabs.com/ 
New generation of poker room software


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