Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Explicit instanciation of Extendable<simgrid::s4u::Host>
authorGabriel Corona <gabriel.corona@loria.fr>
Wed, 20 Jan 2016 15:11:01 +0000 (16:11 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Wed, 20 Jan 2016 16:02:33 +0000 (17:02 +0100)
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
src/s4u/s4u_host.cpp

index 2f5ef50..0d1cfb4 100644 (file)
 #include <simgrid/s4u/forward.hpp>
 
 namespace simgrid {
+
+namespace xbt {
+extern template class XBT_PUBLIC() Extendable<simgrid::s4u::Host>;
+}
+
 namespace s4u {
 
 /** @brief Simulated machine that can host some actors
index 3842d67..d68e07a 100644 (file)
@@ -29,6 +29,11 @@ int ROUTING_HOST_LEVEL;
 int USER_HOST_LEVEL;
 
 namespace simgrid {
+
+namespace xbt {
+template class Extendable<simgrid::s4u::Host>;
+}
+
 namespace s4u {
 
 simgrid::xbt::signal<void(Host&)> Host::onCreation;