简体   繁体   English

如何将不是对象的文件链接到二进制文件中?

[英]How do I link files that aren't objects into binaries?

I'm trying to build a project that runs Lua code from files inside a binary, but I don't know how to put those files into my binary.我正在尝试构建一个项目,该项目从二进制文件中的文件运行 Lua 代码,但我不知道如何将这些文件放入我的二进制文件中。 I know I need to use linker scripts somehow, but I'm inexperienced with linking and building in general.我知道我需要以某种方式使用链接器脚本,但我通常对链接和构建缺乏经验。 The project is using CMake to build and it's for embedded use.该项目使用 CMake 构建,用于嵌入式使用。 The toolchain the project uses is arm-none-eabi-gcc.项目使用的工具链是 arm-none-eabi-gcc。

One option is to use binding library like ZeroMQ.一种选择是使用像 ZeroMQ 这样的绑定库。 Here is the info for ZeroMQ Lua binding .这是ZeroMQ Lua 绑定的信息。 gcc can link ZeroMQ for c or c++ bindings , the messages can be passed to different binary executables as long as API on both sides can interpret bytes or data structure through typecasts. gcc 可以为c 或 c++ 绑定链接 ZeroMQ,只要双方的 API 可以通过类型转换解释字节或数据结构,消息就可以传递给不同的二进制可执行文件。 Another option is to embed Lua into C++ or C by including headers like shown on this blog .另一种选择是通过包含本博客中所示的标头将 Lua 嵌入到 C++ 或 C 中。 Also here is previously asked embedding Lua in c question .之前也有人问过在 c 中嵌入 Lua 的问题 Lua and C linking example can be referred here . Lua 和 C 链接示例可以参考这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么二进制文件没有放在 CMAKE_CURRENT_BINARY_DIR 中? - Why aren't binaries placed in CMAKE_CURRENT_BINARY_DIR? g ++为什么你不必链接iostream二进制文件,但对于pthread你呢? - g++ why don't you have to link iostream binaries but for pthread you do? 如何创建和读取未在函数结束时销毁的非全局变量? - How do I create and read non-global variables that aren't destroyed at end of function? 如何从命令行编译和链接多个文件? - How do I compile and link multiple files from the command line? 如何在 Windows 上链接动态构建的 cmake 文件? - How do I link dynamically built cmake files on Windows? 如何在不使用Makefile的情况下链接多个文件? - How do I link multiple files without the use of a makefile? 我如何正确地将asm文件链接到c ++? - how do i properly link asm files to c++? C ++如何检查2个相似文件中没有哪些单词 - C++ How to Check what words aren't in 2 similar files g++ 编译:我可以链接到带有符号链接二进制文件的目录吗? - g++ compiling: can I link to a directory with symlinked binaries? VC 2010中的静态库中未链接静态对象。如何强制链接? - Static objects are not being linked in a static lib in VC 2010. How do I force a link?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM