Lua中的Windows可执行文件到 [英] Windows Lua to executable

查看:807
本文介绍了Lua中的Windows可执行文件到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个Lua程序(书面lua 5.1)。我在Windows 7中,试图将其转换为一个可执行文件。至今没有运气。我在这里读其他职位使用srlua要做到这一点,所以我已经下载了它的建议,但我在一个损失为下一步该怎么做。我安装了Cygwin,因为我知道这是必要的,但我不知道如何使用srlua到LUA文件转换为可执行文件。任何帮助将AP preciated。

hi I have a Lua program (written in Lua 5.1). I'm on Windows 7, trying to convert it to an executable. No luck so far. I've read other posts here that suggested using srlua to do this so I've downloaded it but I'm on a loss as to what to do next. I installed cygwin as I understand it's necessary but I don't know how to use srlua to convert a lua file into an executable. Any help will be appreciated.

推荐答案

srlua分布为唯一来源,所以你必须先编译它(见的上得到一个免费的C编译器的建议),这个答案

srlua is distributed as source only, so you have to compile it first (see this answer for suggestions on getting a free C compiler).

BTW,Cygwin的是没有必要的。上述链接将带领您说明安装TDM-GCC,GCC编译器的一个Windows端口,将创建可执行文件只依赖于Windows默认的系统库。

BTW, Cygwin is not necessary at all. The aforementioned link will lead you to instructions to install TDM-GCC, a Windows port of GCC compiler that will create executable files which only depend on Windows default system libraries.

一旦你有一个适当的C编译器和编译了srlua,您将有两个可执行文件 glue.exe srlua.exe 。后者只是一个存根,由 srlua.exe 使用与您的Lua脚本加入它来生成最终的可执行文件。

Once you have a C compiler in place and you have compiled srlua, you will have two executable files glue.exe and srlua.exe. This latter is only a stub, used by srlua.exe to generate the final executable by joining it with your Lua script.

假设你的脚本 myscript.lua ,你想创建一个名为 MYEXE.EXE 的可执行文件,你必须调用 glue.exe 命令行如下:

Assuming your script is myscript.lua and you want to create an executable named myexe.exe you must invoke glue.exe from the command line as follows:

 glue.exe srlua.exe myscript.lua myexe.exe

我认为所有相关文件都放在同一个目录中,并已更改为命令行该目录中。

I assumed that all the relevant files are placed in the same directory and you changed to that directory from the command line.

附录:我只是双重检查的官方下载 srlua页我看到也有用于Windows已编译的二进制文件包。所以,你可以跳过所有从源代码部分的编译和只需下载并解压这个

Addendum: I just double checked the official download page for srlua and I saw there is also a package with already compiled binaries for Windows. So you could skip all the compilation from source part and simply download and unpack this.

的二进制文件都在发布存档内的子目录。请注意,这些都是Lua的5.1而已,所以如果你的脚本使用了Lua 5.2的功能,你必须按照我的初步意见,并从源代码编译。

The binaries are in the Release subdirectory inside the archive. Note that these are for Lua 5.1 only, so if your script uses features of Lua 5.2 you must follow my initial advice and compile from source.

这篇关于Lua中的Windows可执行文件到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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