⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 symlib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/symLib.html - generated by refgen from symLib.c --> <title> symLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference :  OS Libraries</i></a></p></blockquote><h1>symLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>symLib</strong> - symbol table subroutine library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./symLib.html#symLibInit">symLibInit</a>(&nbsp;)</b>  -  initialize the symbol table library<br><b><a href="./symLib.html#symTblCreate">symTblCreate</a>(&nbsp;)</b>  -  create a symbol table<br><b><a href="./symLib.html#symTblDelete">symTblDelete</a>(&nbsp;)</b>  -  delete a symbol table<br><b><a href="./symLib.html#symAdd">symAdd</a>(&nbsp;)</b>  -  create and add a symbol to a symbol table, including a group number<br><b><a href="./symLib.html#symRemove">symRemove</a>(&nbsp;)</b>  -  remove a symbol from a symbol table<br><b><a href="./symLib.html#symFindByName">symFindByName</a>(&nbsp;)</b>  -  look up a symbol by name<br><b><a href="./symLib.html#symFindByNameAndType">symFindByNameAndType</a>(&nbsp;)</b>  -  look up a symbol by name and type<br><b><a href="./symLib.html#symByValueFind">symByValueFind</a>(&nbsp;)</b>  -  look up a symbol by value<br><b><a href="./symLib.html#symByValueAndTypeFind">symByValueAndTypeFind</a>(&nbsp;)</b>  -  look up a symbol by value and type<br><b><a href="./symLib.html#symFindByValue">symFindByValue</a>(&nbsp;)</b>  -  look up a symbol by value<br><b><a href="./symLib.html#symFindByValueAndType">symFindByValueAndType</a>(&nbsp;)</b>  -  look up a symbol by value and type<br><b><a href="./symLib.html#symEach">symEach</a>(&nbsp;)</b>  -  call a routine to examine each entry in a symbol table<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides facilities for managing symbol tables.  A symboltable associates a name and type with a value.  A name is simply anarbitrary, null-terminated string.  A symbol type is a small integer(typedef <b>SYM_TYPE</b>), and its value is a pointer.  Though commonly usedas the basis for object loaders, symbol tables may be used wheneverefficient association of a value with a name is needed.<p>If you use the <b><a href="./symLib.html#top">symLib</a></b> subroutines to manage symbol tables local toyour own applications, the values for <b>SYM_TYPE</b> objects are completelyarbitrary; you can use whatever one-byte integers are appropriate foryour application.<p>If you use the <b><a href="./symLib.html#top">symLib</a></b> subroutines to manipulate the VxWorks systemsymbol table (whose ID is recorded in the global <b>sysSymTbl</b>), thevalues for <b>SYM_TYPE</b> are <b>SYM_UNDF</b>, <b>SYM_LOCAL</b>, <b>SYM_GLOBAL</b>, <b>SYM_ABS</b>,<b>SYM_TEXT</b>, <b>SYM_DATA</b>, <b>SYM_BSS</b>, and <b>SYM_COMM</b> (defined in <b>symbol.h</b>).<p>Tables are created with <b><a href="./symLib.html#symTblCreate">symTblCreate</a>(&nbsp;)</b>, which returns a symbol table ID.This ID serves as a handle for symbol table operations, including theadding to, removing from, and searching of tables.  All operations on asymbol table are interlocked by means of a mutual-exclusion semaphorein the symbol table structure.  Tables are deleted with <b><a href="./symLib.html#symTblDelete">symTblDelete</a>(&nbsp;)</b>.<p>Symbols are added to a symbol table with <b><a href="./symLib.html#symAdd">symAdd</a>(&nbsp;)</b>.  Each symbol in thesymbol table has a name, a value, and a type.  Symbols are removed from asymbol table with <b><a href="./symLib.html#symRemove">symRemove</a>(&nbsp;)</b>.<p>Symbols can be accessed by either name or value.  The routine<b><a href="./symLib.html#symFindByName">symFindByName</a>(&nbsp;)</b> searches the symbol table for a symbol with aspecified name.  The routine <b><a href="./symLib.html#symByValueFind">symByValueFind</a>(&nbsp;)</b> finds a symbol with aspecified value or, if there is no symbol with the same value, thesymbol in the table with the next lower value than the specifiedvalue.  The routines <b><a href="./symLib.html#symFindByNameAndType">symFindByNameAndType</a>(&nbsp;)</b> and<b><a href="./symLib.html#symByValueAndTypeFind">symByValueAndTypeFind</a>(&nbsp;)</b> allow the symbol type to be used as anadditional criterion in the searches.<p>The routines <b><a href="./symLib.html#symFindByValue">symFindByValue</a>(&nbsp;)</b> and <b><a href="./symLib.html#symFindByValueAndType">symFindByValueAndType</a>(&nbsp;)</b> areobsolete.  They are replaced by the routines <b><a href="./symLib.html#symByValueFind">symByValueFind</a>(&nbsp;)</b> and<b><a href="./symLib.html#symByValueAndTypeFind">symByValueAndTypeFind</a>(&nbsp;)</b>.<p>Symbols in the symbol table are hashed by name into a hash table forfast look-up by name, e.g., by <b><a href="./symLib.html#symFindByName">symFindByName</a>(&nbsp;)</b>.  The size of the hashtable is specified during the creation of a symbol table.  Look-ups byvalue, e.g., <b><a href="./symLib.html#symByValueFind">symByValueFind</a>(&nbsp;)</b>, must search the table linearly; theselook-ups can thus be much slower.<p>The routine <b><a href="./symLib.html#symEach">symEach</a>(&nbsp;)</b> allows each symbol in the symbol table to beexamined by a user-specified function.<p>Name clashes occur when a symbol added to a table is identical in nameand type to a previously added symbol.  Whether or not symbol tablescan accept name clashes is set by a parameter when the symbol table iscreated with <b><a href="./symLib.html#symTblCreate">symTblCreate</a>(&nbsp;)</b>.  If name clashes are not allowed,<b><a href="./symLib.html#symAdd">symAdd</a>(&nbsp;)</b> will return an error if there is an attempt to add a symbolwith identical name and type.  If name clashes are allowed, addingmultiple symbols with the same name and type will be permitted.  Insuch cases, <b><a href="./symLib.html#symFindByName">symFindByName</a>(&nbsp;)</b> will return the value most recently added,although all versions of the symbol can be found by <b><a href="./symLib.html#symEach">symEach</a>(&nbsp;)</b>.<p>The system symbol table (<b>sysSymTbl</b>) allows name clashes.<p>See the VxWorks Programmmer's Guide for more information aboutconfiguration, intialization, and use of the system symbol table.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>symLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./loadLib.html#top">loadLib</a></b> <hr><a name="symLibInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>symLibInit(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>symLibInit(&nbsp;)</strong> - initialize the symbol table library</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS symLibInit (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes the symbol table package.  If the configurationmacro <b>INCLUDE_SYM_TBL</b> is defined, <b><a href="./symLib.html#symLibInit">symLibInit</a>(&nbsp;)</b> is called by the root task,<b><a href="./usrConfig.html#usrRoot">usrRoot</a>(&nbsp;)</b>, in <b>usrConfig.c</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the library could not be initialized.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./symLib.html#top">symLib</a></b><hr><a name="symTblCreate"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>symTblCreate(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>symTblCreate(&nbsp;)</strong> - create a symbol table</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>SYMTAB_ID symTblCreate    (    int     hashSizeLog2,     /* size of hash table as a power of 2 */    BOOL    sameNameOk,       /* allow 2 symbols of same name & type */    PART_ID symPartId         /* memory part ID for symbol allocation */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates and initializes a symbol table with a hash table of aspecified size.  The size of the hash table is specified as a power of two.For example, if <i>hashSizeLog2</i> is 6, a 64-entry hash table is created.<p>If <i>sameNameOk</i> is FALSE, attempting to add a symbol withthe same name and type as an already-existing symbol results in an error.<p>Memory for storing symbols as they are added to the symbol table will beallocated from the memory partition <i>symPartId</i>.  The ID of the systemmemory partition is stored in the global variable <b>memSysPartId</b>, whichis declared in <b>memLib.h</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>Symbol table ID, or NULL if memory is insufficient.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./symLib.html#top">symLib</a></b><hr><a name="symTblDelete"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>symTblDelete(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>symTblDelete(&nbsp;)</strong> - delete a symbol table</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS symTblDelete    (    SYMTAB_ID symTblId        /* ID of symbol table to delete */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes a specified symbol table.  It deallocates allassociated memory, including the hash table, and marks the table asinvalid.<p>Deletion of a table that still contains symbols results in ERROR.Successful deletion includes the deletion of the internal hash table andthe deallocation of memory associated with the table.  The table is markedinvalid to prohibit any future references.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the symbol table ID is invalid.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./symLib.html#top">symLib</a></b><hr><a name="symAdd"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>symAdd(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>symAdd(&nbsp;)</strong> - create and add a symbol to a symbol table, including a group number</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS symAdd    (    SYMTAB_ID symTblId,       /* symbol table to add symbol to */    char *    name,           /* pointer to symbol name string */    char *    value,          /* symbol address */    SYM_TYPE  type,           /* symbol type */    UINT16    group           /* symbol group */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine allocates a symbol <i>name</i> and adds it to a specified symboltable <i>symTblId</i> with the specified parameters <i>value</i>, <i>type</i>, and <i>group</i>.The <i>group</i> parameter specifies the group number assigned to a module whenit is loaded; see the manual entry for <b><a href="./moduleLib.html#top">moduleLib</a></b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the symbol table is invalidor there is insufficient memory for the symbol to be allocated.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./symLib.html#top">symLib</a></b>, <b><a href="./moduleLib.html#top">moduleLib</a></b><hr><a name="symRemove"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>symRemove(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>symRemove(&nbsp;)</strong> - remove a symbol from a symbol table</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS symRemove    (    SYMTAB_ID symTblId,       /* symbol tbl to remove symbol from */    char *    name,           /* name of symbol to remove */    SYM_TYPE  type            /* type of symbol to remove */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine removes a symbol of matching name and type from aspecified symbol table.  The symbol is deallocated if found.Note that VxWorks symbols in a standalone VxWorks image (where the symbol table is linked in) cannot be removed.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the symbol is not foundor could not be deallocated.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./symLib.html#top">symLib</a></b><hr><a name="symFindByName"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>symFindByName(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>symFindByName(&nbsp;)</strong> - look up a symbol by name</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS symFindByName    (    SYMTAB_ID  symTblId,      /* ID of symbol table to look in */    char *     name,          /* symbol name to look for */    char *     *pValue,       /* where to put symbol value */    SYM_TYPE * pType          /* where to put symbol type */    )</pre>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -