Skip to content

Commit

Permalink
need to split C and namespaced functions for Windows (duplicate symbo…
Browse files Browse the repository at this point in the history
…ls at linkage)
  • Loading branch information
fredroy committed Feb 9, 2024
1 parent c814c77 commit 77931f0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extern "C" {
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName();
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion();
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleComponentList();
SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory);
}

void initExternalModule()
Expand All @@ -58,6 +59,11 @@ const char* getModuleComponentList()
return classes.c_str();
}

void registerObjects(sofa::core::ObjectFactory* factory)
{
registerObjectsInFactory(factory);
}

void init()
{
static bool first = true;
Expand All @@ -68,7 +74,7 @@ void init()
}
}

void registerObjects(sofa::core::ObjectFactory* factory)
void registerObjectsInFactory(sofa::core::ObjectFactory* factory)
{
registerMappedObject(factory);
registerMechanicalObject(factory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

namespace sofa::core
{
struct ObjectFactory;
class ObjectFactory;
}

namespace sofa::component::statecontainer
{
SOFA_COMPONENT_STATECONTAINER_API void init();
extern "C" SOFA_COMPONENT_STATECONTAINER_API void registerObjects(sofa::core::ObjectFactory* factory);
SOFA_COMPONENT_STATECONTAINER_API void registerObjectsInFactory(sofa::core::ObjectFactory* factory);

} // namespace sofa::component::statecontainer
12 changes: 9 additions & 3 deletions Sofa/Component/src/sofa/component/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@

namespace sofa::component
{

extern "C" {
SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule();
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName();
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion();
SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory * factory);
}

void initExternalModule()
Expand All @@ -68,6 +69,11 @@ const char* getModuleVersion()
return MODULE_VERSION;
}

void registerObjects(sofa::core::ObjectFactory* factory)
{
registerObjectsInFactory(factory);
}

void init()
{
static bool first = true;
Expand Down Expand Up @@ -99,9 +105,9 @@ void init()
}
}

void registerObjects(sofa::core::ObjectFactory* factory)
void registerObjectsInFactory(sofa::core::ObjectFactory* factory)
{
sofa::component::statecontainer::registerObjects(factory);
sofa::component::statecontainer::registerObjectsInFactory(factory);
}

} // namespace sofa::component
4 changes: 2 additions & 2 deletions Sofa/Component/src/sofa/component/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

namespace sofa::core
{
struct ObjectFactory;
class ObjectFactory;
}

namespace sofa::component
{
SOFA_COMPONENT_API void init();
extern "C" SOFA_COMPONENT_API void registerObjects(sofa::core::ObjectFactory* factory);
SOFA_COMPONENT_API void registerObjectsInFactory(sofa::core::ObjectFactory* factory);
} // namespace sofa::component

0 comments on commit 77931f0

Please sign in to comment.