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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:26:36+00:00 2026-06-07T11:26:36+00:00

so I’m working on upgrading the architecture of application to a more modular design.

  • 0

so I’m working on upgrading the architecture of application to a more modular design. It’s a C++ application which uses an underlying monolithic c-library if we are building for a specific target, otherwise it uses a different library back-end.

Currently the application front-end code, the GUI code, is directly tied to the monolithic c-library, which only works on one target. What has been done is the monolithic c-library has been put into a “module” which exposes a common C++ interface for the GUI part of the application to consume. This way we can change build targets and the GUI code doesn’t change. The previously existing GUI code uses structures defined within the C-library, which are common to all possible c-libraries.

Inside the C++ module I’ve defined sort-of proxy types which look like so:

//ModuleTypes.hpp
typedef CPP_TYPE C_LEGACY_TYPE;

and the GUI code simply uses CPP_TYPE in-place of the previously existing C_LEGACY_TYPE.

Elsewhere in the module project, Module.hpp looks like:

//Module.hpp
#include "C_LEGACY_TYPES.hpp"
...
#include "ModuleTypes.hpp"

So when the C++ module gets compiled into a static lib, Module.hpp includes C_LEGACY_TYPES.hpp before ModuleTypes.hpp (so ModuleTypes.hpp knows what C_LEGACY_TYPE is),
and the static library compiles just fine.

The problem is in the GUI module, where for example:

//Gui1.hpp
class Gui1 {
    void Method1(CPP_TYPE value);
};

Since CPP_TYPE cannot be forward declared, at the top I add #include “ModuleTypes.hpp” to Gui1.hpp.

//Gui1.hpp
#include "ModuleTypes.hpp"
class Gui1 {
    void Method1(CPP_TYPE value);
};

When I go to compile the GUI module, it errors because it can’t figure out what C_LEGACY_TYPE is. The only way to solve this is to #include “C_LEGACY_TYPE.hpp” inside ModuleTypes.hpp. This however leads to GUI having to know where the legacy C headers are when it gets compiled.

I would like GUI.hpp to #include “ModuleTypes.hpp” but use the definition of C_LEGACY_TYPE from the static library, and not have to #include “C_LEGACY_TYPES.h” inside “ModuleTypes.hpp.”

I understand why the error is happening, I’m looking for an alternative solution. How do I get the GUI module to be able to use the types defines in ModuleTypes.hpp without having to include the legacy headers when compiling the GUI module?

With the architecture change we’re migrating the C++11 so I’m open to any suggestions. VC2010 is what we’re building with.

  • 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-07T11:26:38+00:00Added an answer on June 7, 2026 at 11:26 am

    You’re doing the right thing by separating the back-end C library behind a common interface layer (wrapper class), so you can easily replace the back-end with something else later.

    However, you also need to ensure that the types used in the interface to the C library are similarly isolated within the wrapper class. Since your GUI layer needs to include the C_LEGACY_TYPE.hpp header file, I suspect your types are not being isolated as they should be.

    This may mean that you need to do some type conversion inside the wrapper class, to convert from types the GUI knows about to the types used by the C library. The interface of the wrapper class (ie. the common interface) must not contain any of the types specific to the back-end C library.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have an autohotkey script which looks up a word in a bilingual dictionary
I'm trying to select an H1 element which is the second-child in its group

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.