Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use preinit_array to set argc/argv in init_globally example #3211

Merged
merged 1 commit into from Mar 6, 2018

Conversation

msimberg
Copy link
Contributor

@msimberg msimberg commented Mar 5, 2018

Fixes #3208.

Proposed Changes

  • Use .preinit_array section instead of .init_array to get argc and argv in the init_globally example.

Any background context you want to provide?

The problem in #3204 was that argc and argv were not initialized before the global manage_global_runtime object was constructed, leading hpx::start to fail (assumes that argc >= 1).

From my brief googling it seems that functions in .preinit_array are supposed to run before constructors of global objects, but I could not find a definitive source (this was the best I could find), and it's not clear to me why release and debug behave differently. This should, however, not be worse than using .init_array.

@NK-Nikunj Could you try this out to see that this doesn't just work on my system?

Copy link
Member

@NK-Nikunj NK-Nikunj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msimberg Runtime error has been fixed with the proposed changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants