原生C有通用符号吗?
阅读C11标准n1570 https://web.cs.dal.ca/~vlado/pl/C_Standard_2011-n1570.pdf. 它的索引甚至没有提到常见的符号。
另请仔细阅读海湾合作委员会文档 https://gcc.gnu.org/onlinedocs/gcc/ and 这个草案 http://starynkevitch.net/Basile/bismon-chariot-doc.pdf report.
也许您参考的是ELF https://en.wikipedia.org/wiki/Executable_and_Linkable_FormatLinux 上使用的文件格式目标文件 https://en.wikipedia.org/wiki/Object_file and 可执行文件 https://en.wikipedia.org/wiki/Executable。在那里你可以找到常见符号的提及,这些符号往往被弃用......阅读 Linux ABI 规范等here https://refspecs.linuxfoundation.org/.
我的建议是将所有公共符号声明为extern
在一些头文件中(#include
-d 在你的大部分*.c
文件),并定义它们once(没有extern
) in a single 翻译单位 https://en.wikipedia.org/wiki/Translation_unit_(programming)。你可以使用简单的预处理器 https://gcc.gnu.org/onlinedocs/cpp/技巧(例如X-macros https://en.wikipedia.org/wiki/X_Macro).
您可能对使用 C 代码生成器感兴趣,例如lemon https://www.hwaci.com/sw/lemon/ or SWIG https://swig.org/,或开发您的脚本(使用GNU awk https://www.gnu.org/software/gawk/manual/gawk.html or Guile https://www.gnu.org/software/guile/guile.html or Python https://python.org or GPP https://logological.org/gpp等等... ....)简单来说元编程 https://en.wikipedia.org/wiki/Metaprogramming技巧(autoconf https://www.gnu.org/software/autoconf/可能会很鼓舞人心)生成一些 C 代码。配置您的构建自动化 https://en.wikipedia.org/wiki/Build_automation tool (GNU make https://www.gnu.org/software/make/, ninja https://ninja-build.org/...) 适当地。
您可能有兴趣使用静态分析仪选项 https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html and 预编译头文件 https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html最近的海湾合作委员会。也看看Clang 静态分析器 https://clang-analyzer.llvm.org/ and 铿锵整齐 https://clang.llvm.org/extra/clang-tidy/ and Frama-C https://frama-c.com/.
你肯定想通过-Wall -Wextra -g -H
to https://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html#Invoking-GCC gcc
并阅读如何调试小程序 https://ericlippert.com/2014/03/05/how-to-debug-small-programs/ and Modern C https://modernc.gforge.inria.fr/download.html.