[MacRuby-devel] [MacRuby] #282: <MacRuby/MacRuby.h> cannot be included in Objective-C++ source files
MacRuby
ruby-noreply at macosforge.org
Sun Jun 7 22:53:51 PDT 2009
#282: <MacRuby/MacRuby.h> cannot be included in Objective-C++ source files
---------------------------+------------------------------------------------
Reporter: easco@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: minor | Milestone:
Component: MacRuby | Keywords:
---------------------------+------------------------------------------------
The definitions in ruby/ruby.h contain code that will not compile in an
Objective-C++ source file. In particular, RCLASS_VERSION, RCLASS_META and
similar definitions like it use a (void *) pointer as the base for some
pointer arithmetic. For example:
# define RCLASS_VERSION(m) (*(long *)((void *)m + (sizeof(void *) * 3)))
The problem is the (void *) typecast before "m". C++ does not allow
pointer arithmetic based off of a (void *) pointer.
I was able to work around this issue by hacking my local copy of the
header to use an unsigned char * in the place of the void * value. I'm
not sure this is the right solution... but it appears that "m" should be
typecast to some kind of "pointer to a byte".
--
Ticket URL: <http://www.macruby.org/trac/ticket/282>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list