Experimental Physics and Industrial Control System
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
<2004>
2005
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
<2004>
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024