Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 947101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:01:49+00:00 2026-05-15T23:01:49+00:00

So basically, I have two applications. Application 1 launches Application 2 but it remains

  • 0

A tiny pointer problem :)

So basically, I have two applications. Application 1 launches Application 2 but it remains in memory. When Application 2 is started it needs to be given a pointer to a CALayer object which is stored in the first application. The object represented by the pointer needs to be accessible by both applications. I am using Objective-C. I would really appreciate any examples.

I need something more cross-platform and Distributed Objects are Mac OS X specific. And it is not a matter of me not knowing that CALayer’s are Mac specific (well kindof because of iOS). I know that pretty damn well, it is just that I want to be using a cross-platform solution instead of a specific one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:01:50+00:00Added an answer on May 15, 2026 at 11:01 pm

    You will not be able to pass a pointer across application boundaries as the processes will have different address spaces. If you need to refer to that object and initiate operations against it you will need to use a distributed object system or other interprocess communication layer.

    The impression I get is that you want to spawn the child process, have it update some shared data structure and then exit. One possibility would be to use a shared memory system such as mmap (2) or System V shared memory. Unfortunately portable shared memory is a bit harder to achieve across Windows and Unix/Linux, and you would probably have to make some platform specific wrappers. This MSDN article should give you a starter on a mmap-like facility on Windows, but I’ve never done shared memory on this platform so I can’t really vouch for any of the ins and outs.

    Another possibility would be to serialise the object and pass the serialised data structure between the processes with a pipe or other mechanism. Again, doing this portably is somewhat fraught as IPC on Unix and Windows works quite differently.

    Note that with shared memory, the object will have to be initialised within the shared memory pool, which means that this will have to be allocated first. Otherwise you will need to copy the data in and out of the shared pool explicitly. If the data structure has any pointers within it then this movement will break the pointers.

    The latter point also means that the parent ahd child process will also need to map the shared memory into the same virtual address if you intend to follow pointers within the shared data structure. The alternative if you need references within the data structure is to implement them as handles or offsets from a base. This will complicate the code that builds your data structure so mapping to the same address so you can use pointers is a win.

    Also swot up on security of files used for mmap if you decide to use this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.