Skip to content

Commit

Permalink
Move registerRecordDeviceDriver to imports.py
Browse files Browse the repository at this point in the history
Otherwise import softioc.device will seg fault
  • Loading branch information
coretl committed May 5, 2021
1 parent 0448475 commit af652c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions softioc/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@
from .softioc import dbLoadDatabase

from epicsdbbuilder import *
from epicscorelibs import path
from epicscorelibs.ioc import \
iocshRegisterCommon, registerRecordDeviceDriver, pdbbase

iocshRegisterCommon()
dbLoadDatabase("base.dbd", os.path.join(path.base_path, "dbd"))
dbLoadDatabase("devIocStats.dbd", os.path.dirname(__file__))

if registerRecordDeviceDriver(pdbbase):
raise RuntimeError('Error registering')

InitialiseDbd()
LoadDbdFile(os.path.join(os.path.dirname(__file__), 'device.dbd'))
Expand Down
10 changes: 10 additions & 0 deletions softioc/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
from ctypes import *

from epicscorelibs import path
from epicscorelibs.ioc import \
iocshRegisterCommon, registerRecordDeviceDriver, pdbbase

from . import _extension


# These are in the extension
def get_DBF_values():
"""Return {DBF_name: DBF_int_value} mapping"""
Expand Down Expand Up @@ -119,6 +122,13 @@ def EpicsDll(dll):
epicsExit = libmiscIoc.epicsExit
epicsExit.argtypes = ()

iocshRegisterCommon()
dbLoadDatabase("base.dbd", os.path.join(path.base_path, "dbd"), None)
dbLoadDatabase("devIocStats.dbd", os.path.dirname(__file__), None)

if registerRecordDeviceDriver(pdbbase):
raise RuntimeError('Error registering')


__all__ = [
'get_field_offsets',
Expand Down

0 comments on commit af652c2

Please sign in to comment.