summaryrefslogtreecommitdiff
path: root/src/sim/init.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2016-06-28 03:50:00 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2016-06-28 03:50:00 -0400
commit50e9d0df51247f4aeafe63cdab2a0f53a09cc8e4 (patch)
treea18ea042820119cfcf1d97f7070ed782816c39d9 /src/sim/init.hh
parent9c8710430eb671b5e89f291b9f0a10b6156ac633 (diff)
downloadgem5-50e9d0df51247f4aeafe63cdab2a0f53a09cc8e4.tar.xz
scons: Track swig packages when loading embedded swig code
This patch changes how the embedded swig code is loaded to ensure that gem5 works with swig 3.0.9. For Python 2.7 and above, swig 3.0.9 now relies on importlib, and actually looks in the appropriate packages, even for the wrapped C code. However, the swig wrapper does not explicitly place the module in the right package (it just calls Py_InitModule), and we have to take explicit action to ensure that the swig code can be loaded. This patch adds the information to the generated wrappers and the appropriate calls to set the context as part of the swig initialisation. Previous versions of swig used to fall back on looking in the global namespace for the wrappers (and still do for Python 2.6), but technically things should not work without the functionality in this patch.
Diffstat (limited to 'src/sim/init.hh')
-rw-r--r--src/sim/init.hh11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sim/init.hh b/src/sim/init.hh
index 766cb4365..2bbcd23da 100644
--- a/src/sim/init.hh
+++ b/src/sim/init.hh
@@ -33,10 +33,8 @@
#include <Python.h>
-/*
- * Data structure describing an embedded python file.
- */
#include <list>
+#include <string>
#include <inttypes.h>
@@ -45,6 +43,9 @@ struct _object;
typedef _object PyObject;
#endif
+/*
+ * Data structure describing an embedded python file.
+ */
struct EmbeddedPython
{
const char *filename;
@@ -70,7 +71,9 @@ struct EmbeddedSwig
{
void (*initFunc)();
- EmbeddedSwig(void (*init_func)());
+ std::string context;
+
+ EmbeddedSwig(void (*init_func)(), const std::string& _context);
static std::list<EmbeddedSwig *> &getList();
static void initAll();