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

  • SEARCH
  • Home
  • 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 4343002
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:41:30+00:00 2026-05-21T11:41:30+00:00

I have a project that contains several submodules, that communicate using some objects that

  • 0

I have a project that contains several submodules, that communicate using some objects that are serialized by one process and then deserialized by another process and used at this other point. So these objects need to contain logic for usage in the first process, in the second process as well as serialization and deserialization logic.

To simplify building the project each process first builds a library and then links with that library (using a specialized main) to build the actually process. All the parts that handle communication (i.e. all the cross cutting objects) are also contained in other more general libraries.

Now the problem is that the code for usage of the generic library contains methods that reference other objects from the second process. So the structure is something like this:

  • ProcessA:
    • Depends on libA libGeneric
  • ProcessB:
    • Depends on libB libGeneric
  • libGeneric contains code that references parts of libA and libB

This way I get a dependency of processA for libB that I do not want. The dependency is just to satisfy the linker, because the code that uses libB is never actually called (but the linker will not know this). So for now I am linking in libB into processA although the code from that lib wont ever be executed.

Is there a better way to handle such a situation? Another Idea would be to just define the interface and only include the methods that are actually used everywhere in libGeneric and put the other methods into libB. However then I would split up object from libGeneric which would make maintenance harder.

I am using G++ 4.4 for compilation.


edit:
since I cannot post code from the actual project here some structured pseudocode that might show the problem more clearly:

class Record {
public:
  void produce(...) // called from Process A
  std::string serialize() const;
  void deserialize(const std::string &);

  void do_something(queue) { // called from process B
    // this logic is actually more complicated (depends on subclasses of Record)
    // i.e. cannot be moved out of this class without getting ugly
    queue.add_for_further_processing( this ); // The queue is part of ProcessB
  }
};

From this the best method seems to remove all threading stuff (of which the queue is part) to a common submodule and then have all processes use that.

  • 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-21T11:41:30+00:00Added an answer on May 21, 2026 at 11:41 am

    One way to solve this is to dynamically link with libB (if the size of the executable is your concern).

    The other option is to take the common code out of libA and libB into a library (libC). Then, your programs will need to link with libA and libC, and libB and libC.

    I do not see other way around this.

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

Sidebar

Related Questions

I have a solution that contains two projects. One project is an ASP.NET Web
I have a solution that contains several projects. One of the test projects is
Our project contains several classes that we have equals() and hashCode() methods generated by
I have a VS2005 project that contains a couple web service references. The project
In Eclipse, I have a workspace that contains all of my projects. Each project
My app project contains several helper classes that serve all kind of different purposes
Within my Subversion project I have a few directories that contain other open source
I have a solution that contains a good deal of projects, I would like
I have a VS solution that contains 6 library projects and 1 web folder
I have project that I'm working on that is going to require a webserver.

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.