aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/libghdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-12-30 10:29:16 +0100
committerTristan Gingold <tgingold@free.fr>2020-12-30 10:29:16 +0100
commitf1c30ad16e0914455ee2c84e80714f6b271021f2 (patch)
tree11ebb7a91faeed8c17fdaf84cd8cd14d334d8c6a /pyGHDL/libghdl
parent56dde6c446367f85882d288d7606015ace7f80ed (diff)
downloadghdl-f1c30ad16e0914455ee2c84e80714f6b271021f2.tar.gz
ghdl-f1c30ad16e0914455ee2c84e80714f6b271021f2.tar.bz2
ghdl-f1c30ad16e0914455ee2c84e80714f6b271021f2.zip
Rework initialization and finalization.
libghdl can now be re-initialized.
Diffstat (limited to 'pyGHDL/libghdl')
-rw-r--r--pyGHDL/libghdl/__init__.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pyGHDL/libghdl/__init__.py b/pyGHDL/libghdl/__init__.py
index da39a4475..431008df3 100644
--- a/pyGHDL/libghdl/__init__.py
+++ b/pyGHDL/libghdl/__init__.py
@@ -76,7 +76,9 @@ _libghdl_path = _get_libghdl_path()
libghdl = ctypes.CDLL(_libghdl_path)
# Initialize it.
+# First Ada elaboration (must be the first call)
libghdl.libghdl_init()
+# Then 'normal' initialization (set hooks)
libghdl.libghdl__set_hooks_for_analysis()
# Set the prefix in order to locate the vhdl libraries.
@@ -84,6 +86,15 @@ libghdl.libghdl__set_exec_prefix(
*_to_char_p(dirname(dirname(_libghdl_path)).encode("utf-8"))
)
+def finalize():
+ "Free all the memory, be ready for a new initialization"
+ libghdl.options__finalize()
+
+
+def initialize():
+ "Initialize or re-initialize the library"
+ libghdl.options__initialize()
+
def set_option(opt):
"Set option OPT. Return true iff the option is known and handled"