-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove static sofainit and call unload into each respective module at…
… atexit
- Loading branch information
Showing
4 changed files
with
30 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
|
||
#include <sofa/core/init.h> | ||
#include <sofa/helper/init.h> | ||
#include <sofa/helper/logging/Messaging.h> | ||
#include <SofaPython3/PythonEnvironment.h> | ||
|
@@ -108,7 +107,6 @@ static void parse_emitter_message_then(py::args args, const Action& action) { | |
PYBIND11_MODULE(Helper, helper) | ||
{ | ||
// These are needed to force the dynamic loading of module dependencies (found in CMakeLists.txt) | ||
sofa::core::init(); | ||
sofa::helper::init(); | ||
|
||
helper.doc() = R"doc( | ||
|
@@ -155,6 +153,12 @@ PYBIND11_MODULE(Helper, helper) | |
moduleAddMessageHandler(helper); | ||
moduleAddVector(helper); | ||
moduleAddSystem(helper); | ||
|
||
auto atexit = py::module_::import("atexit"); | ||
atexit.attr("register")(py::cpp_function([]() { | ||
sofa::helper::cleanup(); | ||
msg_info("SofaPython3.Helper") << "Sofa.Helper unload()"; | ||
})); | ||
} | ||
|
||
} ///namespace sofapython3 |
This file contains 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
This file contains 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