Embed Lua into C++(将 Lua 嵌入 C++)
问题描述
我想编写一个可以在执行过程中交互/调用 Lua 脚本的 C++ 程序.该程序的一个关键概念是完全独立于平台,但我似乎无法找到实际提供某些东西的 Lua 构建.
I want to write a C++-Program that can interact/call Lua-scripts during execution. A key concept of the program is complete platform independence, but I seem to be unable to locate a Lua-build that actually offers something that.
到目前为止,我发现的 Lua 构建要么基于环境变量,要么基于特定的库,例如 .lib、.dll 或 .so.来自 lua.org 的官方 Lua 源也不是我正在寻找的,因为它定义了一个主要的 -功能...
The Lua-builds I found so far are either based on environment-variables or specific libraries like .lib, .dll or .so. The official Lua-source from lua.org also is not what I'm looking for as it defines a main-function…
是否有一个简单的 - 最好的情况是像 sqlite-amlgamation - Lua-interpreter for C/C++ 没有任何这些依赖项?
Is there a simple - best case would be something like sqlite-amalgamation - Lua-interpreter for C/C++ that doesn't have any of these dependencies?
推荐答案
lua.c 包含 main 并定义了控制台应用程序的入口点.如果您将其从项目中删除,剩下的会构建到独立库中,或者您愿意的话,可以构建动态库.
lua.c contains main and defines the entry point for a console application. If you remove it from the project, whats left builds into a standalone lib, or dynamic library if you prefer, just fine.
这篇关于将 Lua 嵌入 C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 Lua 嵌入 C++
基础教程推荐
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 这个宏可以转换成函数吗? 2022-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 常量变量在标题中不起作用 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 我有静态或动态 boost 库吗? 2021-01-01
