[英]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.