[Openmcl-devel] Carbon FFI: How can I debug this?
david at david-steuber.com
Tue Dec 28 17:58:05 UTC 2004
On Dec 24, 2004, at 5:48 PM, Gary Byers wrote:
> If you get to the point where the third problem is the stumbling
> that's good news: there are several potential solutions.
> - change the code to create windows/menus without using .nib files
> (hard to follow tutorials that way.)
> - refer to the Cocoa example for more bloodcurdling hacks.
> - find a good way to get OpenMCL into an application bundle. Mikel
> Evins - who posts here fairly regularly - has some tools that help
> to simplify this process, and has used them successfully to do
> Carbon programming in OpenMCL.
I have actually gotten as far as getting OpenMCL into an application
bundle using Mikel Evins' Bosco code as an example. After messing with
the code, I fixed some bugs but I am still hung up on one thing:
(#_SetControlData (ccl::%get-ptr travel-time-field)
:<cfs>tring<r>ef :bytes) text)
yields a crash where text is a MACPTR that encapsulates a CFStringRef.
What I actually need to pass in is a CFStringRef* but I haven't figured
out how to do that. I tried using %ptr-to-int which didn't work. Then
I realized that the int would refer to the address of the CFString, not
the CFStringRef. (ccl::%get-ptr text) instead of just text also
yielded a crash.
I also tried to use rlet to allocate a MACPTR on the stack and then
%setf-macptr. That got me around the crash (not sure why), but it
still didn't work even though SetControlData returned noErr. I'm
guessing that didn't create a CFStringRef* like I hoped.
SetControlData is declared as:
OSErr SetControlData (
const void * inData
If I have a MACPTR that holds a CFStringRef, how can I get a MACPTR
that holds the CFStringRef* that points to it? If I can't, what's my
More information about the Openmcl-devel