aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/python/libghdl/__init__.py
blob: 8ca7a977b066967812d596315acd07c584fd7e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import ctypes
import os.path
from libghdl.config import libghdl_filename

# Load the DLL.
_basedir = os.path.dirname(__file__)
libghdl = ctypes.CDLL(os.path.join(_basedir, libghdl_filename))

# Low-level initialization (elaboration).
libghdl.libghdl_init()

# Set the default prefix.
_prefix = os.path.join(_basedir, "ghdl")
_prefix_opt = ("--PREFIX=" + _prefix).encode('utf-8')
libghdl.libghdl__set_option(
    ctypes.c_char_p(_prefix_opt), len(_prefix_opt))