diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-10-05 20:40:33 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-10-05 20:40:33 +0200 |
commit | 640a548573d4c45bfdcdc464dbfa1a5ae64215b6 (patch) | |
tree | d6c72de5af6dca45bf9369d956a76a5afb9cc454 /src/vhdl/python | |
parent | f8bf562141e892483af1f568ed4f3a858fcde878 (diff) | |
download | ghdl-640a548573d4c45bfdcdc464dbfa1a5ae64215b6.tar.gz ghdl-640a548573d4c45bfdcdc464dbfa1a5ae64215b6.tar.bz2 ghdl-640a548573d4c45bfdcdc464dbfa1a5ae64215b6.zip |
python binding: set prefix, add interfaces.
Diffstat (limited to 'src/vhdl/python')
-rw-r--r-- | src/vhdl/python/libghdl/__init__.py | 24 | ||||
-rw-r--r-- | src/vhdl/python/libghdl/thin.py | 6 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/vhdl/python/libghdl/__init__.py b/src/vhdl/python/libghdl/__init__.py index d36f58d9f..d09b70cbd 100644 --- a/src/vhdl/python/libghdl/__init__.py +++ b/src/vhdl/python/libghdl/__init__.py @@ -1,11 +1,23 @@ import ctypes import sys +import os.path -dll_ext = {'linux': '.so', - 'linux2': '.so', - 'darwin': '.dylib', - 'win32': '.dll', - 'cygwin': '.dll'} +_ext = {'linux': '.so', + 'linux2': '.so', + 'darwin': '.dylib', + 'win32': '.dll', + 'cygwin': '.dll'} -libghdl = ctypes.CDLL("libghdl" + dll_ext.get(sys.platform, '.so')) +# Load the DLL. +_basedir = os.path.join(os.path.dirname(__file__), '..') +libghdl = ctypes.CDLL(os.path.join( + _basedir, 'libghdl' + _ext.get(sys.platform, '.so'))) + +# Low-level initialization (elaboration). libghdl.libghdl_init() + +# Set the default prefix. +_prefix = os.path.join(_basedir, "ghdl") +_prefix_opt = "--PREFIX=" + _prefix +libghdl.libghdl__set_option( + ctypes.c_char_p(_prefix_opt), len(_prefix_opt)) diff --git a/src/vhdl/python/libghdl/thin.py b/src/vhdl/python/libghdl/thin.py index 9110e3f3d..f8b5f3eac 100644 --- a/src/vhdl/python/libghdl/thin.py +++ b/src/vhdl/python/libghdl/thin.py @@ -46,10 +46,16 @@ Get_File_Buffer.restype = c_char_p Get_Name_Length = libghdl.name_table__get_name_length +Get_Name_Ptr = libghdl.name_table__get_name_ptr +Get_Name_Ptr.restype = c_char_p + # std.standard Standard_Package = c_int32.in_dll(libghdl, "std_package__standard_package") +# libraries + +Get_Libraries_Chain = libghdl.libraries__get_libraries_chain Null_Iir = 0 Null_Iir_List = 0 |