开发者

Sendind pointers to different process and using them?

开发者 https://www.devze.com 2023-01-11 18:24 出处:网络
Is it possibl开发者_C百科e 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?

Is it possibl开发者_C百科e 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号