什么是符号表? [英] What is a symbol table?

查看:218
本文介绍了什么是符号表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能描述一个符号表的C和C ++的范围内呢?

Can someone describe what a symbol table is within the context of C and C++?

推荐答案

这里有符号表的两个常见的,相关的含义。

There are two common and related meaning of symbol tables here.

首先,在你的目标文件的符号表。通常情况下,C或C ++编译器编译一个源文件与一个.OBJ或扩展名.o的目标文件。这包含可执行code和数据连接器可以处理成工作的应用程序或共享库的集合。对象文件有一个称为在它一个符号表,该目标文件中的不同项目映射到该链接器可以理解的名称的数据结构。如果您从code调用一个函数,编译器不会把常规的最终地址的目标文件英寸相反,它把一个占位符值到code,并增加了一张纸条,告诉连接器从所有目标文件中查找在不同的符号表参考它的处理,并坚持最终位置在那里。

First, there's the symbol table in your object files. Usually, a C or C++ compiler compiles a single source file into an object file with a .obj or .o extension. This contains a collection of executable code and data that the linker can process into a working application or shared library. The object file has a data structure called a symbol table in it that maps the different items in the object file to names that the linker can understand. If you call a function from your code, the compiler doesn't put the final address of the routine in the object file. Instead, it puts a placeholder value into the code and adds a note that tells the linker to look up the reference in the various symbol tables from all the object files it's processing and stick the final location there.

其次,这里还有一个共享库或DLL的符号表。这是由连接体产生并用于命名所有的功能和数据项是图书馆的用户可见。这使得系统做运行时的链接,解决这些名字,其中库加载到内存中的位置打开引用。

Second, there's also the symbol table in a shared library or DLL. This is produced by the linker and serves to name all the functions and data items that are visible to users of the library. This allows the system to do run-time linking, resolving open references to those names to the location where the library is loaded in memory.

如果您想了解更多,我建议约翰·莱文的优秀图书链接器和加载。<一个href=\"http://books.google.com/books?id=h34d_jr2iikC&dq=levine+linkers+and+loaders&pg=PP1&ots=IxGcKQO03W&sig=dduAcRRhK6E2nMlkTxbNEDpWBTg&hl=en&sa=X&oi=book_result&resnum=1&ct=result\">link文字

If you want to learn more, I suggest John Levine's excellent book "Linkers and Loaders".link text

这篇关于什么是符号表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆