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 8706543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:38:22+00:00 2026-06-13T03:38:22+00:00

Suppose I have class Base and Derived : public Base . I have constructed

  • 0

Suppose I have class Base and Derived : public Base.
I have constructed a shared memory segment using boost::interprocess library. Is it possible to have code similar to this:

Base* b = new Derived(); 
write(b); //one app writes
Base* b2 = read(b); //second app reads
//b equals b2 (bitwise, not the ptr location)

The problems I see here is for instance that the required space for a derived class of Base is unknown (so how much shmem to allocate?)

Q: how to pass objects via pointers between applications?

  • 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-06-13T03:38:23+00:00Added an answer on June 13, 2026 at 3:38 am

    Just read its documentation

    In particular:

    Virtuality forbidden

    The virtual table pointer and the virtual table are in the address
    space of the process that constructs the object, so if we place a
    class with a virtual function or virtual base class, the virtual
    pointer placed in shared memory will be invalid for other processes
    and they will crash.

    This problem is very difficult to solve, since each process needs a
    different virtual table pointer and the object that contains that
    pointer is shared across many processes. Even if we map the mapped
    region in the same address in every process, the virtual table can be
    in a different address in every process. To enable virtual functions
    for objects shared between processes, deep compiler changes are needed
    and virtual functions would suffer a performance hit. That’s why
    Boost.Interprocess does not have any plan to support virtual function
    and virtual inheritance in mapped regions shared between processes.

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

Sidebar

Related Questions

Suppose I have a base and derived class: class Base { public: virtual void
Suppose I have a Base class and its derived class Derived as follows: class
Suppose we have two classes: class Base { private: int x; public: void f();
Suppose I have the following (trivially simple) base class: public class Simple { public
Suppose I have some code like this: class Base { public: virtual int Foo(int)
suppose we have this class structure: public class BaseClass { public BaseClass() { Console.WriteLine(Base
Suppose I have 1 base class and a derived class. The derived class has
Suppose I have a Base & Derived class: class Base{ private: int* _privateIntPtrB; protected:
Suppose I have this class hierarchy: class A { public: virtual void foo(Base *b)
Suppose I have two classed Base and Derived , i.e.: #include <iostream> class Base

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.