From f2e9bf81aebf9a0d39563c3f955fc24e9270d74f Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Wed, 20 Jan 2016 16:11:01 +0100 Subject: [PATCH] Explicit instanciation of Extendable It seems the `deleters_` static variable (of a template class) is not uniquified on some systems (where the symbols are `STB_GLOBAL`) when using Java loadLibrary leading to the JAVA_HOST_LEVEL being the same as another level. On some systems, the symbols are `STB_GNU_UNIQUE` which purpose is to avoid this kind of behaviour and the bug does not happen. By using explicit instanciation, the `deleters_` variable is not allocated in each shared-object but only in `libsimgrid.so`. --- include/simgrid/s4u/host.hpp | 5 +++++ src/s4u/s4u_host.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index 2f5ef50fdc..0d1cfb4d75 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -19,6 +19,11 @@ #include namespace simgrid { + +namespace xbt { +extern template class XBT_PUBLIC() Extendable; +} + namespace s4u { /** @brief Simulated machine that can host some actors diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 3842d674e9..d68e07a7b3 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -29,6 +29,11 @@ int ROUTING_HOST_LEVEL; int USER_HOST_LEVEL; namespace simgrid { + +namespace xbt { +template class Extendable; +} + namespace s4u { simgrid::xbt::signal Host::onCreation; -- 2.20.1