Question

Is it possible to send a pointer to an object via Mach IPC by casting it into an int and then casting it back into the object. Would that work and how can that be done?

I want to send a CALayer object over to a different process. I don't think I can send raw objects via Mach IPC.

Was it helpful?

Solution

That won't work, because pointers are specific to the memory of the process that they originate in. If you send a pointer to a different process, it will point to invalid memory if you're lucky. If you're unlucky it will point to valid memory, but to a completely different object than the one you wanted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top