FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Replace exported settings globals with typed accessors by paulromano · Pull Request #4080 · openmc-dev/openmc · GitHub

Replace exported settings globals with typed accessors - #4080

Open
paulromano wants to merge 1 commit into
openmc-dev:developfrom
paulromano:c-api-global-settings
Open

Replace exported settings globals with typed accessors#4080
paulromano wants to merge 1 commit into
openmc-dev:developfrom
paulromano:c-api-global-settings

Conversation

Copy link
Copy Markdown
Contributor

Description

Continuing toward Windows support — this PR is aimed at avoiding the need for Windows-specific exports (similar to #4065). In this case, the Python bindings currently read and write mutable OpenMC settings directly with ctypes.in_dll, which requires implementation details to be exported from the shared library. This change replaces those data accesses with name-based C API getter and setter pairs for boolean, 32-bit integer, 64-bit integer, and double settings, along with a read-only string getter. An alternative would be to have a get/set pair for each setting specifically, but that has the downside of requiring more functions in the long term. This design allows us to handle future settings without introducing new C API functions. The existing openmc.lib.settings properties remain unchanged for users while their ctypes implementation is reduced to one accessor pair per datatype.

One other change I made here is to move the body of int main() into a dedicated openmc_main entry point within libopenmc, and the installed executable simply delegates to it. This again helps us avoid exporting global symbols just for Windows.

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 force-pushed the c-api-global-settings branch from cf2c539 to 42e329c Compare August 28, 2026 18:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL