Skip to content

[Core, Simulation.Core] MSVC: fix inconsistent linkages#6084

Merged
th-skam merged 2 commits intosofa-framework:masterfrom
fredroy:fix_link_warnings_msvc
Apr 23, 2026
Merged

[Core, Simulation.Core] MSVC: fix inconsistent linkages#6084
th-skam merged 2 commits intosofa-framework:masterfrom
fredroy:fix_link_warnings_msvc

Conversation

@fredroy
Copy link
Copy Markdown
Contributor

@fredroy fredroy commented Apr 16, 2026

MSVC throws these compilation and linkage warnings:

J:\0\src\Sofa\framework\Simulation\Core\src\sofa\simulation\fwd.cpp(29): warning C4273: 'sofa::core::castTo': inconsistent dll linkage
J:\0\src\Sofa\framework\Simulation\Core\src\sofa/simulation/fwd.h(58): note: see previous definition of 'castTo'
J:\0\src\Sofa\framework\Simulation\Core\src\sofa\simulation\fwd.cpp(29): warning C4273: 'sofa::core::castToBase': inconsistent dll linkage
J:\0\src\Sofa\framework\Simulation\Core\src\sofa/simulation/fwd.h(58): note: see previous definition of 'castToBase'
J:\0\src\Sofa\framework\Simulation\Core\src\sofa\simulation\fwd.cpp(29): warning C4273: 'sofa::core::objectmodel::base::GetClass': inconsistent dll linkage
J:\0\src\Sofa\framework\Simulation\Core\src\sofa/simulation/fwd.h(58): note: see previous definition of 'GetClass'
symbol '??$castTo@PEAVNode@simulation@sofa@@@core@sofa@@YAPEAVNode@simulation@1@PEAVBase@objectmodel@01@@Z (class sofa::simulation::Node * __cdecl sofa::core::castTo<class sofa::simulation::Node *>(class sofa::core::objectmodel::Base *))' defined in 'fwd.obj' is imported by 'Node.obj'
symbol '??$GetClass@VNode@simulation@sofa@@@base@objectmodel@core@sofa@@YAPEBVBaseClass@123@XZ (class sofa::core::objectmodel::BaseClass const * __cdecl sofa::core::objectmodel::base::GetClass<class sofa::simulation::Node>(void))' defined in 'fwd.obj' is imported by 'DefaultVisualManagerLoop.obj' in function '"public: static bool __cdecl sofa::core::PathResolver::FindLinkDest<class sofa::simulation::Node>(class sofa::core::objectmodel::Base *,class sofa::simulation::Node * &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class sofa::core::objectmodel::BaseLink const *)" (??$FindLinkDest@VNode@simulation@sofa@@@PathResolver@core@sofa@@SA_NPEAVBase@objectmodel@12@AEAPEAVNode@simulation@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBVBaseLink@412@@Z)'
symbol '?castToBase@core@sofa@@YAPEAVBase@objectmodel@12@PEAVNode@simulation@2@@Z (class sofa::core::objectmodel::Base * __cdecl sofa::core::castToBase(class sofa::simulation::Node *))' defined in 'fwd.obj' is imported by 'DefaultVisualManagerLoop.obj' in function '"protected: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl sofa::core::objectmodel::TLink<class sofa::simulation::DefaultVisualManagerLoop,class sofa::simulation::Node,32>::_doGetLinkedPath_(unsigned __int64)const " (?_doGetLinkedPath_@?$TLink@VDefaultVisualManagerLoop@simulation@sofa@@VNode@23@$0CA@@objectmodel@core@sofa@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_K@Z)'
symbol '??$castTo@PEAVNode@simulation@sofa@@@core@sofa@@YAPEAVNode@simulation@1@PEAVBase@objectmodel@01@@Z (class sofa::simulation::Node * __cdecl sofa::core::castTo<class sofa::simulation::Node *>(class sofa::core::objectmodel::Base *))' defined in 'fwd.obj' is imported by 'DefaultVisualManagerLoop.obj' in function '"public: static bool __cdecl sofa::core::PathResolver::FindLinkDest<class sofa::simulation::Node>(class sofa::core::objectmodel::Base *,class sofa::simulation::Node * &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class sofa::core::objectmodel::BaseLink const *)" (??$FindLinkDest@VNode@simulation@sofa@@@PathResolver@core@sofa@@SA_NPEAVBase@objectmodel@12@AEAPEAVNode@simulation@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBVBaseLink@412@@Z)'

because the macro is called from Sofa.Simulation.Core, but the macro integrates the SOFA_CORE_API so it leads to inconsistency for import/export keywords.

The solution in the PR is a bit ad-hoc so maybe a better one could be implemented instead

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: status wip Development in the pull-request is still in progress pr: clean Cleaning the code pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Apr 16, 2026
@fredroy
Copy link
Copy Markdown
Contributor Author

fredroy commented Apr 16, 2026

[ci-build][with-all-tests]

@bakpaul bakpaul removed the pr: fast merge Minor change that can be merged without waiting for the 7 review days label Apr 16, 2026
Copy link
Copy Markdown
Contributor

@alxbilger alxbilger left a comment

Choose a reason for hiding this comment

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

The other solution is to move Node in Core

@fredroy fredroy force-pushed the fix_link_warnings_msvc branch from 2a215e8 to 12db051 Compare April 21, 2026 03:54
Copy link
Copy Markdown
Contributor

@th-skam th-skam left a comment

Choose a reason for hiding this comment

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

macos crash is the usual timeout (SofaImplicitField)

@th-skam th-skam added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Apr 23, 2026
@th-skam th-skam merged commit 0559fe5 into sofa-framework:master Apr 23, 2026
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: clean Cleaning the code pr: status ready Approved a pull-request, ready to be squashed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants