EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  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  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: How do I use registryFunctionAdd
From: Marty Kraimer <[email protected]>
To: Rozelle Wright <[email protected]>
Cc: [email protected]
Date: Tue, 30 Jul 2002 08:22:27 -0500
I am attaching an example that works for subRecord.

The Makefile will just contain one extra statement similar to


example_SRCS += dbSubExample.cpp


Please note that the example works because constructors for static C++ objects
get called when a application starts (on vxWorks when ld command is executed).
The end of the example has the statements:

/*
 * Register commands on application startup
 */
class mySubRegister {
  public:
    mySubRegister() { mySubRecordFunctionsRegister(); }
};
static mySubRegister mySubRegisterObj;


mySubRegisterObj is a static object. At application startup its constructor is
executed. In this example the constructor just calls
mySubRecordFunctionsRegister.

Marty Kraimer

Rozelle Wright wrote:
> 
> I am attempting to make a genSub record work with EPICS 3.14.beta1 using an
> example application and iocsh running on a pc with WINDOWS XP.  I see that
> registry information is automatically generated for the record, device and
> driver support from the dbd file, but I don't know how to persuade iocinit
> to find the functions that I need for the initialization and processing of
> the subroutine record.
> The genSubRecord code calls  registryFunctionFind to retrieve the address
> of the function from the name in the record (and fails because the
> functions are not registered).
> According to the registry section of the application developers guide, I
> should be using registryFunctionAdd to register the function, but I am not
> sure where to put this call.
> Has anyone done this who could give me an example?
> 
> Thanks for any help you can give me.
> Rozelle Wright
> [email protected]
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

#include <registryFunction.h>
#include <subRecord.h>

extern "C" {
typedef long (*processMethod)(subRecord *precord);
long mySubInit(subRecord *precord,processMethod process);
long mySubProcess(subRecord *precord);
void mySubRecordFunctionsRegister(void);
}

long mySubInit(subRecord *precord,processMethod process)
{
    printf("%s mySubInit process %p\n",precord->name,process);
    return(0);
}

long mySubProcess(subRecord *precord)
{
    printf("%s mySubProcess\n",precord->name);
    return(0);
}

void mySubRecordFunctionsRegister(void)
{

    if(!registryFunctionAdd("mySubInit",(REGISTRYFUNCTION)mySubInit))
      errlogPrintf("mySubRecordFunctionsRegister registryFunctionAdd failed\n");
    if(!registryFunctionAdd("mySubProcess",(REGISTRYFUNCTION)mySubProcess))
      errlogPrintf("mySubRecordFunctionsRegister registryFunctionAdd failed\n");
}

/*
 * Register commands on application startup
 */
class mySubRegister {
  public:
    mySubRegister() { mySubRecordFunctionsRegister(); }
};
static mySubRegister mySubRegisterObj;


Replies:
Re: How do I use registryFunctionAdd Rozelle Wright
References:
How do I use registryFunctionAdd Rozelle Wright

Navigate by Date:
Prev: How do I use registryFunctionAdd Rozelle Wright
Next: Re: side-effect of malloc() in startup file Peregrine M. McGehee
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  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: How do I use registryFunctionAdd Rozelle Wright
Next: Re: How do I use registryFunctionAdd Rozelle Wright
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  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 ·