Skip to content

[SofaGLFW, SofaImGui] Fix init calls (and fix import modules from python) - #295

Merged
epernod merged 1 commit into
sofa-framework:masterfrom
fredroy:fix_init_guis
Aug 20, 2026
Merged

epernod merged 1 commit into
sofa-framework:masterfrom
fredroy:fix_init_guis

Conversation

@fredroy

@fredroy fredroy commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Had a problem to import SofaImGui in a python script (called directly from python)
It appeared that there was collisions because of the unmangled stuff.
Longer explanation by Claude

The cause: ELF symbol interposition on initExternalModule

initExternalModule is declared extern "C" with default visibility, so it lands in the dynamic symbol table as the plain, unmangled name initExternalModule. Every SOFA plugin does the same thing — 109 libraries in your build export that identical symbol:

$ nm -D --defined-only lib*.so | grep -w initExternalModule   # → 109 hits

Because the caller and callee are in the same shared library but the symbol is global and preemptible, GCC does not bind the call locally. It routes it through the PLT:

0000000000265750 <sofaimgui::init()>:
  ...
  2657a7:  call   1a0f50 <initExternalModule@plt>     ← interposable

At load time, that PLT slot gets filled with whatever initExternalModule is first in the global lookup scope — which is the earliest-loaded plugin, not SofaImGui itself. LD_DEBUG=bindings shows it directly:

binding file libSofaGLFW.so.26.12.99 [0] to libSofaCarving.so [0]: normal symbol `initExternalModule'
binding file libSofaImGui.so.26.12.99 [0] to libSofaCarving.so [0]: normal symbol `initExternalModule'

All the other plugins do this way actually.

@epernod
epernod merged commit 35a9109 into sofa-framework:master Aug 20, 2026
8 checks passed
EulalieCoevoet pushed a commit to EulalieCoevoet/SofaGLFW that referenced this pull request Oct 9, 2026
EulalieCoevoet added a commit to SofaComplianceRobotics/SofaGLFW that referenced this pull request Oct 19, 2026
* [SofaImGui] misc suggested improvements (SW25)

* instanciation and implementation

* [ViewportWindow] move scene not camera (tranlsation right/left)

* cleaning

* allows object selection with highlight in scene

* initializes BaseViewer

* cleaning

* no disabled options in context menus

* removes icon for components with components

* adds workbench principle

* disable animation in scene editor workbench

* refactoring workbench (flags)

* allows users to explore the workbench

* miror display options (View Menu / Viewport Buttons)

* adds components window

* update wrt SOFA#5805 changes

* adds ProfilerWindow and monir refactor

* list of changes:
- disable changing workbench when the robot is connected
- disable the simulation/robot button if no robot (from the python API) has been detected
- minor renaming

* adds buttons for quick access to workbench

* store fps

* add performances as tooltip of the FPS text

* restores default dock sizes

* enable mouse interaction in simulation mode

* minor esthetic changes (workbench buttons)

* minor changes (remove url from componentswindow)

* change icon

* adds tooltip

* Revert "miror display options (View Menu / Viewport Buttons)" and use instance of ViewMenu instead

This reverts commit 202a274.

* add viewport context menu

* fixes compilation on Windows

* highlight selected workbench icon

* fix 3d view context menu (only when window is hovered)

* [ComponentWindow] list examples

* Adds GUIData to BaseWindow

* rename IPController to KinematicsController

* rename displayDisableInfoMessage to showInfoMessage

* enable all windows, only disable features in windows

* adds description of the windows and refactoring

* Implements addData for MyRobotWindow

* fixes extra pop / push instroduced in refactoring

* fixes extra pop / push instroduced in refactoring

* Updates PlottingWindow, refactors MyRobotWindow and Modul_SofaImGui

* Updates IOWindow with new API

* Updates IOWindow and adds DataMonitorWindow

* IOWindow refactoring

* IOWindow.Input.addData

* wip

* [SceneGraphWindow] Cleaning (#118)

* [SceneGraphWindow] cleaning

* Update SofaImGui/src/SofaImGui/windows/SceneGraphWindow.cpp

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

---------

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

* [SofaGLFW/SofaImGui] Adds video recorder (#108)

* [All] Adds video recorder

* records in screenshots folder

* generalizes generated filename with date and time

* disabled in scene editor workbench

* adds to viewmenu and viewport context menu

* [ComponentsWindow] list components examples (#102)

* [ComponentsWindow] list components examples

* [SofaImGui] ImGuiGUIEngine: init mouse interaction enabled (#101)

---------

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

* [SofaImGui] Widget: adds missing float widget (#103)

* [SofaImGui] Widget: adds missing float widget

* fixes scientific e format

* [SofaGLFW] use ctrl+shift for keyboard events (#104)

* [SofaGLFW] use ctrl+shift for keyboard events

* [SofaImGui] Format LocalTextLinkOpenURL and add useful links (#106)

* [SofaImGui] open documentation and format LocalTextLinkOpenURL

* correct usage of ellipsis

* adds more links

* [MouseManagerWindow] fixes crash (#107)

* [Widgets] refactoring and limits table vertical size in windows (#105)

* [Widgets] refactoring and limits table vertical size in windows

* add bounding box widget

* Precomputes table size before starting the table

---------

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

* [SofaImGui] Cleaning simulation driving window (#109)

* [SofaImGui] cleaning simulation driving window

* fixes compilation

* [resources] adds new icons and fixes alignement

* adds RecordVideoWindow

* review requested changes: adds message on footer status bar in failure

* Apply suggestion from @EulalieCoevoet

* Adds error footer message if no file has been recorded

* Apply review suggestion

---------

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

* fixes guidata namespace

* wip

* wip

* wip (it compiles)

* fixes segfault

* fixes myrobot window

* cleaning

* wip effectorguidata and movewindow

* fixes program window

* wip

* cleaning

* remove group from groupGUIData if list is empty

* list of changes:
- rename DataMonitor to Dashboard
- implements drag and drop of data to the window (needs changes in imgui)
- adds context menu to delete the data

* remove instead of delete

* list of changes:
- change dropping area style
- add info
- create an area to drop the data

* fix

* clear dashboard

* detect and add warning when the data has no owner

* fix merge

* add bindings

* fix binding and add help

* uniformize data drawing, add a min size for the droping region

* add buttons

* refactoring

* header default open, cleaning

* cleaning

* user should add the target themself for now

* minor changes (improve info message)

* implement review request

* change clear icon (broom)

* cleaning, remove help view (from review(

* cleaning

* refactoring

* Update SofaImGui/bindings/src/Binding_DashboardWindow.cpp

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

* refactoring and implement request

* use indices from PositionEffector instead of 0

* deprecate MoveWindow bindings

* MoveWindow TCP rotation

* [MoveWindow] actuators, direct problem

* cleaning

* cleaning

* list of changes:
- cleaning (m_ for class member variable)
- refactoring LogWindow
- add accessory

* [ComponentsWindow] implements #144

* minor color fix

* [IOWindow] onEndInit: kinematicsGUIDataManager to selectableData

* list of changes:
- keep windows layout when switching workbenches
- save windows layout for all workbenches when saving project

* [windows] refactoring

* allow accessory with no min and max (ex: bool)

* [widgets] cleaning

* [windows] register setting mechanism

* enable MyRobotWindow in Simulation workbench

* [windows] register new settings

* fix warnings

* [ImGuiGUIEngine] store docks size by workbench

* [PlottingWindow] add binding to set subplot

* [PlottingWindow] fix buffers

* [PlottingWindow] drop data to plot

* add option to remove all data

* [widget] disabled to read only

* [SofaImGui] clear logs and footer status bar

* [Viewport] display gui framerate

* minor cleaning

* [windows] minor color changes

* Revert "[SofaImGui] clear logs and footer status bar"

This reverts commit 30cf15b.

* requested changes

* minor cleaning

* [Program] custom block

* allow program window without TCP

* allow drag and drop vectors

* drag drop target color and size

* [ImGuiGUIEngine] only change layout if a project file has been loaded

* cleaning and axis color

* add start-end option to vec of vec widgets

* Minor fixes for Windows compilation

* make the deprecated bindings work

* make the deprecated bindings work

* Update SofaImGui/bindings/src/Binding_PlottingWindow.cpp

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

* Cleans deprecation messages MoveWindow

* Cleans deprecation message

* make the deprecated bindings work

* cleaning

* cleaning

* cleaning

* cleaning

* cleaning

* fix compile after merge

* [SofaImGui] register guidata to window settings

* export / import custom bock and some fix

* refactoring

* add warnings

* implement requested changes

* add driving combo in simulation mode workbench

* Update program description in ProgramWindow

* fix custom block ID problem

* Update SofaImGui/src/SofaImGui/models/actions/Custom.cpp

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>

* [ImGuiGUIEngine] fix docks size save

* renaming

* [SofaGLFW] only animate when viewport focused

* [SofaImGui] register guidata to window settings

* implement requested changes

* implement requested changes

* fix save program filename

* minor renaming

* Apply changes from SOFA PR #6117 (sofa-framework#283)

* Apply changes from SOFA PR #6117

* Add Base to base class name

* [SceneGraphWindow] fix data path in case of parent ownership

* [SofaImGui] MoveWindow: fixes and improvements

* Delete SofaImGui/src/SofaImGui/models/Group.cpp

* Delete SofaImGui/src/SofaImGui/models/Group.h

* [MyRobotWindow] fix missing push/pop ID

* [BaseWindow] remove cleaning gui data on end simulation load

* [SofaGLFW] apply sofa/SofaGLFW#278, capture continuous key pressing

* implements suggestion

* cleaning

* [Gizmos] not clickable when hidden

* [SofaGLFW, SofaImGui] Fix init calls (and fix import modules from python) (sofa-framework#295)

* Introduce clamped scalar ensuring value not outside bounds (sofa-framework#292)

* apply sofa changes

* discussed changes

* fix compilation

* fix compilation (ci)

* [SofaImGui] minor fix

---------

Co-authored-by: HanaeRateau <hanaerateau@yahoo.fr>
Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com>
Co-authored-by: Frederick Roy <fredroy@users.noreply.github.com>
Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>
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.

2 participants