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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:21:45+00:00 2026-05-26T08:21:45+00:00

I am working on a cross platform project in C++, under IOS and Android,

  • 0

I am working on a cross platform project in C++, under IOS and Android, and I am having the following situation
:

I am writing a library used to load scene graphs directly from xml files describing them. The library has a base tree node class, that implements all the functionality to make a class constructable by it’s name. Then additional tree nodes are implemented, all deriving from this base node class. This works excellent but there is one problem. The linker ‘thinks’ that some of my classes are not going to be used and strips them out of the library. I have a nasty workaround right now, having a file that includes all existing nodes headers, and in this file one instance of every node is being created and altered to indicate the compiler/linker that this class is really being used.

Does anybody know a good design pattern that can be used to automatically generate the required instances of all classes?

I have tried to create macros that are placed into the classes cpp file that creates a static instance of the given class, but the linker still detects that those static instances are never going to be referenced.

Or is there a linker flag that can be used to tell the linker not to strip any unused classes out? Like already mentioned: I am working on Android (ndk 6.0) and on IOS (xcode 4.2)

This problem is not going to be a showstopper for my project but it would really be nice to find an acceptable solution here.

  • 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-26T08:21:46+00:00Added an answer on May 26, 2026 at 8:21 am

    It is implementation-defined whether the dynamic initialization of a non-local variable with static storage
    duration is done before the first statement of main. If the initialization is deferred to some point in time
    after the first statement of main, it shall occur before the first odr-use (3.2) of any function or variable
    defined in the same translation unit as the variable to be initialized.

    Therefore there’s no standard way to guarantee the construction of those objects but to list them all in one specific place.

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

Sidebar

Related Questions

I am working on a cross platform OpenGL project and it seems that all
In a cross-platform (Windows, FreeBSD) C++ project I'm working on, I am making use
When working in cross-platform project, most probably you will encounter a lot of #ifdef
I'm working on a cross platform project that uses STL. The other compiler includes
I'm currently working on a cross-platform task scheduler, but I'm having a problem with
Working on a cross-platform project in C++, which must read input files in a
Background I'm working on a cross-platform Zeroconf/Bonjour/DNS-SD library for Haskell, and figured my best
I'm working on a cross platform application in Java which currently works nicely on
I'm about to upload a project I've been working on onto Sourceforge under the
I am working on a cross platform that needs to use a database to

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.