EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: RE: ? initHookRegister()
From: "Liyu, Andrei" <[email protected]>
To: Marty Kraimer <[email protected]>
Cc: [email protected]
Date: Wed, 21 Jan 2004 09:19:53 -0500
Thank you very much.
I have small question according 2. Why should static object be?
I tried in Windows:

//Server.h
class CServer{
	...
};
extern CServer * pCServer;

//Server.cpp
....
CServer oCServer;
CServer * pCServer = & oCServer;

It works too.
Andrei.

-----Original Message-----
From: Marty Kraimer [mailto:[email protected]] 
Sent: Monday, January 19, 2004 8:50 AM
To: Liyu, Andrei
Cc: [email protected]
Subject: Re: ? initHookRegister()

Liyu, Andrei wrote:
> Hi,
> 
> 	If I like to do some job during IOC initialization I should call
> initHookRegister(). But I couldn't understand where (how) can I call
> this function before iocInit()?

I can think of three ways.

1) Call your routine from the st.cmd file

     Assume you have a function

     int initMyHook(void)
     {
         return(initHookFunction(myHookFunction));
     }


    the st.cmd file contains
    initMyHook
    iocInit

2) Use a C++ static object.

    class initMyHook {
        public:
           initMyHook() {initHookFunction(myHookFunction);}
    }
    static initMyHook initMyHookObj;

    The constructor initMyHook will get called for initMyHookObj at load
time.

3) For 3.14.4 or later use the registrar facility

    In your xxxInclude.dbd file the following must appear

    registrar(myHook)

    Your source file contains

    static void myHook(void)
    {
        static int firstTime = 1;
        if(!firstTime) return;
        firstTime=0;
        initHookFunction(myHookFunction);
    }
    epicsExportRegistrar(myHook);


For 3.14.4 and later method 3) is the recommended method.

> 	Can anybody write couple words about IOC deinitialization? Has
> Epics similar hook here?
> 

Sorry but iocCore is currently written to run forever. There is no
deinitialization.

> Thanks, Andrei.
> 




Replies:
RE: ? initHookRegister() Ralph Lange

Navigate by Date:
Prev: Re: ? initHookRegister() Ralph Lange
Next: RE: ? initHookRegister() Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: ? initHookRegister() Ralph Lange
Next: RE: ? initHookRegister() Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·