Skip to content

Fix/libpython loading - #38

Merged
StephenSmith25 merged 2 commits into
masterfrom
fix/libpython-loading
Nov 12, 2026
Merged

StephenSmith25 merged 2 commits into
masterfrom
fix/libpython-loading

Conversation

@StephenSmith25

Copy link
Copy Markdown
Owner

No description provided.

StephenSmith25 and others added 2 commits November 12, 2026 19:35
The wrapper library was not linked against libpython on Linux/macOS, so it could
only be loaded into a process that already had Python (e.g. FMPy). Plain
importers (OMSimulator, fmusim, Simulink, ...) failed with "undefined symbol:
_Py_NoneStruct".

The FMU library is now a small shim with no Python dependency. On the first
instantiation it opens libpython with RTLD_GLOBAL if the host does not already
provide it, then loads the real implementation (libpythonfmu-backend, built
with FMI3_FUNCTION_PREFIX) from the same folder and forwards all FMI calls.

libpython is looked up via PYTHONFMU_PYTHON_LIBRARY, then the build
interpreter's library recorded in resources/pythonfmu_libpython.txt, then
standard names for Python 3.8-3.14. Windows is unchanged (links python3.dll).

- generate_shim.py generates the forwarders from fmi3FunctionTypes.h
- builder only renames the entry-point library and records the libpython hint
- tests: run a built FMU from a plain C host; docs: install.md section

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X8Wmw797DJpgrMFmT6n8CG
- README and docs index: FMUs now run in any FMI 3.0 importer, what the
  simulating machine needs, and PYTHONFMU_PYTHON_LIBRARY
- dependencies.md: which Python environment the FMU uses per importer type
  (incl. virtualenv + PYTHONPATH)
- docs/changelog.md (in mkdocs nav) listing the user-facing changes on this
  branch and fix/wrapper-robustness

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X8Wmw797DJpgrMFmT6n8CG
@StephenSmith25
StephenSmith25 merged commit 7655aa9 into master Nov 12, 2026
9 checks passed
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