EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs
epicsExport.h File Reference

Exporting IOC objects. More...

#include <shareLib.h>
Include dependency graph for epicsExport.h:

Go to the source code of this file.

Macros

#define epicsExportSharedSymbols
 
#define EPICS_EXPORT_POBJ(typ, obj)   pvar_ ## typ ## _ ## obj
 
#define EPICS_EXPORT_PFUNC(fun)   EPICS_EXPORT_POBJ(func, fun)
 
#define epicsExportAddress(typ, obj)
 Declare an object for exporting. More...
 
#define epicsExportRegistrar(fun)   epicsShareFunc REGISTRAR EPICS_EXPORT_PFUNC(fun) = (REGISTRAR) &fun
 Declare a registrar function for exporting. More...
 
#define epicsRegisterFunction(fun)
 Declare and register a function for exporting. More...
 

Typedefs

typedef void(* REGISTRAR )(void)
 

Detailed Description

This header is unique, as it defines epicsExportSharedSymbols and thus triggers a transition between importing declarations from other libraries, to exporting symbols from our own library. The comments in shareLib.h provide more information.

This header should be included with a trailing comment to make it stand out from other includes, something like this:

#include <epicsExport.h> // defines epicsExportSharedSymbols

Definition in file epicsExport.h.

Macro Definition Documentation

#define epicsExportAddress (   typ,
  obj 
)
Value:
epicsShareExtern typ *EPICS_EXPORT_POBJ(typ,obj); \
epicsShareDef typ *EPICS_EXPORT_POBJ(typ, obj) = (typ *) (char *) &obj

The epicsExportAddress() macro must be used to declare any IOC object that is also named in a DBD file. For example a record support source file must contain a statement like:

A device support source file must contain a statement like:

Note that the typ parameter for a device support entry table must be spelled dset even if the obj was actually declared as some other type, say using typed_dset .

A driver support source file must contain a statement like:

A variable named in a DBD variable statement must be declared with:

int myDebug = 0;
epicsExportAddress(int, myDebug);

Only int and double are currently supported for DBD variables.

Parameters
typObject's data type.
objObject's name.
Note
C++ code needs to wrap with
extern "C" { }

Definition at line 75 of file epicsExport.h.

#define epicsExportRegistrar (   fun)    epicsShareFunc REGISTRAR EPICS_EXPORT_PFUNC(fun) = (REGISTRAR) &fun

The epicsExportRegistrar() macro must be used to declare a registrar function that is named in a DBD registrar statement. For example:

static void myRegistrar(void) {
...
}
epicsExportRegistrar(myRegistrar);
Parameters
funRegistrar function's name.
Note
C++ code needs to wrap with
extern "C" { }

Definition at line 94 of file epicsExport.h.

#define epicsRegisterFunction (   fun)
Value:
static void register_func_ ## fun(void) \
{ \
registryFunctionAdd(#fun, (REGISTRYFUNCTION) fun); \
} \
epicsExportRegistrar(register_func_ ## fun)
#define epicsExportRegistrar(fun)
Declare a registrar function for exporting.
Definition: epicsExport.h:94

The epicsRegisterFunction() macro must be used to declare and register a function that is named in a DBD function statement and called by one or more subroutine or aSub records. For example:

epicsRegisterFunction(mySubProcess);
Parameters
funFunction's name
Note
C++ code needs to wrap with
extern "C" { }

Definition at line 111 of file epicsExport.h.