This is Unofficial EPICS BASE Doxygen Site
osdFindSymbol.c File Reference
#include <vxWorks.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <symLib.h>
#include <sysSymTbl.h>
#include <fcntl.h>
#include <unistd.h>
#include <loadLib.h>
#include "dbmf.h"
#include "epicsString.h"
#include "epicsFindSymbol.h"
+ Include dependency graph for osdFindSymbol.c:

Go to the source code of this file.

Macros

#define _VSB_CONFIG_FILE   <../lib/h/config/vsbConfig.h>
 

Functions

LIBCOM_API void * epicsLoadLibrary (const char *name)
 
LIBCOM_API const char * epicsLoadError (void)
 
void * epicsFindSymbol (const char *name)
 

Macro Definition Documentation

#define _VSB_CONFIG_FILE   <../lib/h/config/vsbConfig.h>

Definition at line 12 of file osdFindSymbol.c.

Function Documentation

void* epicsFindSymbol ( const char *  name)

Definition at line 67 of file osdFindSymbol.c.

68 {
69  STATUS status;
70 
71 #if _WRS_VXWORKS_MAJOR < 6 || _WRS_VXWORKS_MINOR < 9
72  char *pvalue;
73  SYM_TYPE type;
74 
75  status = symFindByName(sysSymTbl, (char *)name, &pvalue, &type);
76  if (!status)
77  return pvalue;
78 
79  if (name[0] == '_' ) {
80  status = symFindByName(sysSymTbl, (char *)(name+1), &pvalue, &type);
81  }
82 #if CPU_FAMILY == MC680X0
83  else {
84  char *pname = dbmfMalloc(strlen(name) + 2);
85 
86  pname[0] = '_';
87  strcpy(pname + 1, name);
88  status = symFindByName(sysSymTbl, pname, &pvalue, &type);
89  dbmfFree(pname);
90  }
91 #endif
92  if (!status)
93  return pvalue;
94 
95 #else
96 
97  SYMBOL_DESC symDesc;
98 
99  memset(&symDesc, 0, sizeof(SYMBOL_DESC));
100  symDesc.mask = SYM_FIND_BY_NAME;
101  symDesc.name = (char *) name;
102  status = symFind(sysSymTbl, &symDesc);
103  if (!status)
104  return symDesc.value;
105 
106  if (name[0] == '_') {
107  symDesc.name++;
108  status = symFind(sysSymTbl, &symDesc);
109  if (!status)
110  return symDesc.value;
111  }
112  /* No need to prepend an '_'; 68K-only, no longer supported */
113 #endif
114  return 0;
115 }
pvd::Status status
pvd::StructureConstPtr type
void dbmfFree(void *mem)
Free the memory allocated by dbmfMalloc.
Definition: dbmf.c:175
const std::string pname
void * dbmfMalloc(size_t size)
Allocate memory.
Definition: dbmf.c:97
LIBCOM_API const char* epicsLoadError ( void  )

Definition at line 57 of file osdFindSymbol.c.

58 {
59  if (oldmsg)
60  free(oldmsg);
61 
62  oldmsg = errmsg;
63  errmsg = NULL;
64  return oldmsg;
65 }
#define NULL
Definition: catime.c:38
LIBCOM_API void* epicsLoadLibrary ( const char *  name)

Definition at line 31 of file osdFindSymbol.c.

32 {
33  MODULE_ID m = 0;
34  int fd;
35 
36  if (oldmsg) {
37  free(oldmsg);
38  oldmsg = NULL;
39  }
40  if (errmsg) {
41  free(errmsg);
42  errmsg = NULL;
43  }
44 
45  fd = open(name, O_RDONLY, 0);
46  if (fd != ERROR) {
47  m = loadModule(fd, GLOBAL_SYMBOLS);
48  close(fd);
49  }
50 
51  if (!m) {
52  errmsg = epicsStrDup(strerror(errno));
53  }
54  return m;
55 }
#define NULL
Definition: catime.c:38
char * epicsStrDup(const char *s)
Definition: epicsString.c:233