[MacRuby-devel] Getting a pointer to a boxed type

Mark Rada mrada at marketcircle.com
Wed Dec 1 22:16:31 PST 2010


Hi,

With the recent closing of ticket #1002 I have been trying to take a bunch of Objective-C code and write it in MacRuby.

One problem that I have run into is with the AXValueGetValue() function in AXValue.h. The last argument to the function is supposed to be the address of a structure to populate; a fragment of that code would look like this:

	AXValueRef value = (AXValueRef)[self valueOfAttribute:attribute];
	CGPoint point;
	AXValueGetValue( value, kAXValueCGPointType, &point );
	return point;

If I wanted to write this in MacRuby I think I would have to do something like this:

	value =  valueOfAttribute attribute
	point = CGPoint.new
	AXValueGetValue( value, KAXValueCGPointType, point.address_of )
	point

Except that I have not come across a way to get the address of an object in MacRuby. I have tried the #object_id but then I get errors about the function wanting a Pointer.

Is there a way to get a pointer to a specific object or a way to get the address of an object?

Thanks,
	Mark



More information about the MacRuby-devel mailing list