Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以通过Mach IPC通过将指针转换为int然后将其转换回对象来发送指向对象的指针。那会起作用吗?怎么做?
我想将 CALayer 对象发送到不同的进程。我认为我不能通过Mach IPC发送原始对象。
那是行不通的,因为指针特定于它们起源的进程的内存。如果您将指针发送到不同的进程,如果幸运的话,它将指向无效的内存。如果您不走运,它将指向有效内存,但指向与您想要的完全不同的对象。