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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:30:40+00:00 2026-05-31T23:30:40+00:00

I have a library which has a basic class which is used extensively by

  • 0

I have a library which has a basic class which is used extensively by the particular library in question (say library_1).

namespace library_1 {
    class some_class {
    }
}

I have want this library to use instead another version of this class that I am defining.

namespace my_own {
    class some_class {
    }
}

my_own::some_class and library_1::some_class are going to have the same public interface (but different data members so they are not exactly dynamic castable). So I want to be able to compile this library replacing just this one class. This is doable.

The complication in this whole process, however, is that I have a second library (whose source code I do not have access to, call it library_2) which makes use of the first library (including accesses to some_class).

My main executable needs to access both library_2 (which is compiled against the original library) and a different version of the library_1 with this some_class replaced.

I know this is a complicated situation but what is the best way to achieve this (from a code perspective and about how to maintain this in version control)?

  • 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-31T23:30:41+00:00Added an answer on May 31, 2026 at 11:30 pm

    What you can do is to expose just the API for the part where you need to use your replace class and compile the corresponding portion into a dynamically linked library, statically resolving all symbols to the library you are meddling with. Obviously, the meddled with objects shall not escape this interface. With this, you program can effectively use two conflicting implementations of the same library although they won’t be able to shared objects. Essentially, this is how COM exposes its interface but this technique works on other platforms than Windows although I wouldn’t be come up with the needed steps in creating a shared library doing this for a UNIX system.

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

Sidebar

Related Questions

I have existing Linux shared object file (shared library) which has been stripped. I
I have a document library in MOSS 2007 which has folders and files. Document
I have a c-library which I use in gcc. The library has the extension
I have a class library project which contains some content files configured with the
I have a class library which I maintain in it's own project/solution. It contains
I have this library called BASS which is an audio library which I'm going
I have a C++ library which I deliver to other developers. One of them
I have created a library which reads the app.config file and gets the type
I have kind of library which uses a bunch of its own perf counters.
I have a very painful library which, at the moment, is accepting a C#

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.