EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: record/device/driver support export
From: Marty Kraimer <[email protected]>
To: "Anderson, Janet B." <[email protected]>, "Johnson, Andrew N." <[email protected]>, Eric Norum <[email protected]>, Jeff Hill <[email protected]>, [email protected], Marty Kraimer <[email protected]>
Date: Tue, 01 Apr 2003 10:01:14 -0600
Yesterday Janet and I finally got exampleApp to work on win32 with the simplified build rules. This required that record/device/driver support be built as shared libraries just like other components of base.

Currently record and device support are handled differently. Driver support is not handled.

I thought of way to accomplish the goal via a more generic method.

A new header epicsShareExport.h will be created. It will define two macros.

epicsShareExportAddress(type,obj)

and

epicsShareExportRegistrar(func)

epicsShareExportAddress can be used to export the address of any object to a sgared library. It will be used for record/device/driver support and also for other stuff users think of.

devAiSoft.c will contain the definitions

#include        "epicsShareExport.h"
...
epicsShareExportAddress(dset,devAiSoft);

aiRecord.c will contain the definitions

#include        "epicsShareExport.h"
...
epicsShareExportAddress(rset,aiRSET);



epicsShareExportRegistrar is used to export the address of a function with no arguments and that returns void. Such a function will normally perform other registration. Thus the name Registrar.

For example dbSubExample.c in exampleApp will be
#include <stdio.h>

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

typedef long (*processMethod)(subRecord *precord);

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

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

static registryFunctionRef mySubRef[] = {
    {"mySubInit",(REGISTRYFUNCTION)mySubInit},
    {"mySubProcess",(REGISTRYFUNCTION)mySubProcess}
};

static void mySub(void)
{
    registryFunctionRefAdd(mySubRef,NELEMENTS(mySubRef));
}

epicsShareExportRegistrar(mySub);



The actual definition for epicsShareExport.h is

#ifndef INCepicsShareExporth
#define INCepicsShareExporth

#ifdef __cplusplus
extern "C" {
#endif

#include <registryFunction.h>
#define epicsExportSharedSymbols
#include <shareLib.h>

#define EPICS_SHARE_POBJ(obj) p ## obj

#define epicsShareExportAddress(typ,obj) \
epicsShareExtern typ *EPICS_SHARE_POBJ(obj); \
epicsShareDef typ *EPICS_SHARE_POBJ(obj) = (typ *)&obj

#define epicsShareExportRegistrar(func) \
epicsShareFunc REGISTRYFUNCTION EPICS_SHARE_POBJ(func) = &func

#ifdef __cplusplus
}
#endif

#endif /* epicsShareExporth */




Replies:
Re: record/device/driver support export Marty Kraimer

Navigate by Date:
Prev: RE: Change-Request: Hostnames used for Channel Access / Access Security Jeff Hill
Next: Re: record/device/driver support export Marty Kraimer
Index: 2002  <20032004  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: Change-Request: Hostnames used for Channel Access / Access Security Jeff Hill
Next: Re: record/device/driver support export Marty Kraimer
Index: 2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·