EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Registering DBD files and iocshRegisterCommon
From: <[email protected]>
To: <[email protected]>, <[email protected]>, <[email protected]>
Date: Fri, 7 Dec 2012 13:17:35 +0000
From: Andrew Johnson [mailto:[email protected]]
> On 2012-12-05 [email protected] wrote:
> > 2. Is what I'm trying to do below sane?
> Yes, with the caveat that the 3.15.0.1 development release won't
> currently allow it.  I have been asked to make it possible again
> in the future though, and I've been doing some thinking about how
> to do that.

Well, hopefully by the time we pick up 3.15 you will have fixed this.  I'm encouraged to hear that Dirk also uses this mechanism.

> > 1. Load the .so file.
> 
> I assume you're using the dlload.dbd and dlload command that's already
> included with Base for this step.

Curiously enough, no.  In fact, some readers may wince at this, this is all being done in Python!  So my code is simply (modulo quite a bit of framework to figure out what dbd_path, lib_path and reg_name should actually be, and a C implementation of get_pdbbase()):

	dbLoadDatabase(dbd_path, None, None)
	lib_so = ctypes.cdll.LoadLibrary(lib_path)
	register = getattr(lib_so, '%s_registerRecordDeviceDriver' % reg_name)
	register(get_pdbbase())

> > I imagine there's no particular guarantee that this
> > function is idempotent, is there?
> 
> It should be since all it does is register commands

That's good, but can we make sure we keep it that way?  That was the point behind my suggested patch.

> > Could we perhaps make the fact that iocshRegisterCommon can safely be
> > called repeatedly more explicit by applying the following patch?
> 
> I am reluctant to make that change for 3.14.12.3 now that we've
> published the release candidate, especially since it's not an
> essential modification.

Sure, there's no need for it to go into any existing release, I was just thinking of protecting the code against future accidents, so pushing it into trunk would comfort me a trifle.  This changes "it should be idempotent" to "of course it is!"



From: Dirk Zimoch [mailto:[email protected]]
> I am doing exactly this for years with 3.14. I found it did not work
> any more for 3.15 because of a change in registerRecordDeviceDriver.pl.
> I have asked Andrew to give the old functionality back.

Well, we've both asked, I'm sure he'll oblige ;)

> BTW, you are probably interested in my "require" command which
> 
> 0. Checks dependencies and calls itself recursively if necessary
> 1. loads the lib<module>.so file (or <module>.dll or <module>Lib)
> 2. loads the <module>.dbd file
> 3. calls the <module>_registerRecordDeviceDriver function

Where would I find this?  I already have a framework (written in Python, called the iocbuilder) which not so much does all this but gives me the context in which to do it, so I expect I'll be using that, as mentioned above.


References:
Registering DBD files and iocshRegisterCommon michael.abbott
Re: Registering DBD files and iocshRegisterCommon Andrew Johnson

Navigate by Date:
Prev: Re: Tektronix 3014 Tracing Problem Yujong Kim
Next: Re: Tektronix 3014 Tracing Problem Nicholas P. DiMonte
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Registering DBD files and iocshRegisterCommon Andrew Johnson
Next: EPICS driver for E-517 Rau, Steffen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024