Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions PySpice/Spice/NgSpice/Shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ def __init__(self, ngspice_id=0, send_data=False):

##############################################

already_read_ffi = False

def _load_library(self):

if ConfigInstall.OS.on_windows:
Expand All @@ -369,9 +371,11 @@ def _load_library(self):
if 'SPICE_LIB_DIR' not in os.environ:
os.environ['SPICE_LIB_DIR'] = os.path.join(self.NGSPICE_PATH, 'share', 'ngspice')

api_path = os.path.join(os.path.dirname(__file__), 'api.h')
with open(api_path) as f:
ffi.cdef(f.read())
if not NgSpiceShared.already_read_ffi:
NgSpiceShared.already_read_ffi = True
api_path = os.path.join(os.path.dirname(__file__), 'api.h')
with open(api_path) as f:
ffi.cdef(f.read())

if not self._ngspice_id:
library_prefix = ''
Expand Down