Skip to content

Replace exported C API error globals - #4065

Open
paulromano wants to merge 1 commit into
openmc-dev:developfrom
paulromano:c-api-error-message
Open

Replace exported C API error globals#4065
paulromano wants to merge 1 commit into
openmc-dev:developfrom
paulromano:c-api-error-message

Conversation

@paulromano

Copy link
Copy Markdown
Contributor

Description

Another PR focused on avoiding OPENMC_API for Windows support. This PR replaces the exported OPENMC_E_* variables with a C enum and replaces the fixed-size exported error-message buffer with an internal string exposed through a new openmc_get_err_msg C API function. C++ and Python callers now retrieve error text through the function instead of accessing shared-library data directly. This also has the nice effect of eliminating the fixed 256-character limit that was in place before.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@paulromano
paulromano requested a review from pshriwise as a code owner August 15, 2026 23:24

@GuySten GuySten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@GuySten GuySten added the Merging Soon PR will be merged in < 24 hrs if no further comments are made. label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merging Soon PR will be merged in < 24 hrs if no further comments are made.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants