So the issue came up while experimenting with marshaling values back and forth between Red and Red/System. I would like to access the guts of an object passed to a routine.
I had noticed that there are functions in the Red Runtime for handling things like this, get-values, get-words, etc in the object context. There is a file in the runtime sources called object.reds
How do I utilize these? Can I utilize these? Is there a way to access them without re-including (and by extension compiling) a copy of the (already included) runtime into my app?
You can just call these from inside Red/System routines right away. No additional include is necessary. Here's a brief example:
Red []
get-object-size: routine [
obj [object!]
return: [integer!]
] [
object/get-size obj
]
print get-object-size object [foo: 42 bar: 99]
When you compile and run this, it will eventually output 2
.