Lua1.0 编译准备
2015-11-02 20:14
316 查看
转载出处:http://my.oschina.net/xhan/blog/305943
从官网 www.lua.org/ftp/lua-1.0.tar.gz 下代码。
如何编译,ReadMe 里有这样的说明:
The code compiles and runs in RedHat 5.2 with gcc 2.7.2.3. It may not run in
newer systems, because it assumes that stdin and stdout are constants, though
ANSI C does not promise they are. If make fails, try using the fixed modules
provided in the "fixed" directory. To see the differences (which are really
quite minor), do "make diff".
注意最后一句,也就是把 fixed 目录中的三个文件拷贝到外面覆盖就好了。
fixed 目录中的代码改动如下:
------------------------------
lua.c:
33 行
void main (int argc, char *argv[])
改为
int main (int argc, char *argv[])
52 行
添加 return 0;
------------------------------
iolib.c
20 行
static FILE *in=stdin, *out=stdout;
改为
static FILE *in=NULL, *out=NULL;
395行
添加 in=stdin; out=stdout;
------------------------------
lex_yy.c
20 行
FILE *yyin = {stdin}, *yyout = {stdout};
改为
FILE *yyin = {NULL}, *yyout = {NULL};
为什么这样改,ReadMe 里有说明“It may not run in
newer systems, because it assumes that stdin and stdout are constants, though
ANSI C does not promise they are. ”
这里使用 VS2010 进行分析,建工程,把所有的源文件加入工程,编译,运行。
准备工作完成。
后来试了一下,在 Win7 里用 MinGW,在 Linux 里 gcc 也都可以以编译成功。
从官网 www.lua.org/ftp/lua-1.0.tar.gz 下代码。
如何编译,ReadMe 里有这样的说明:
The code compiles and runs in RedHat 5.2 with gcc 2.7.2.3. It may not run in
newer systems, because it assumes that stdin and stdout are constants, though
ANSI C does not promise they are. If make fails, try using the fixed modules
provided in the "fixed" directory. To see the differences (which are really
quite minor), do "make diff".
注意最后一句,也就是把 fixed 目录中的三个文件拷贝到外面覆盖就好了。
fixed 目录中的代码改动如下:
------------------------------
lua.c:
33 行
void main (int argc, char *argv[])
改为
int main (int argc, char *argv[])
52 行
添加 return 0;
------------------------------
iolib.c
20 行
static FILE *in=stdin, *out=stdout;
改为
static FILE *in=NULL, *out=NULL;
395行
添加 in=stdin; out=stdout;
------------------------------
lex_yy.c
20 行
FILE *yyin = {stdin}, *yyout = {stdout};
改为
FILE *yyin = {NULL}, *yyout = {NULL};
为什么这样改,ReadMe 里有说明“It may not run in
newer systems, because it assumes that stdin and stdout are constants, though
ANSI C does not promise they are. ”
这里使用 VS2010 进行分析,建工程,把所有的源文件加入工程,编译,运行。
准备工作完成。
后来试了一下,在 Win7 里用 MinGW,在 Linux 里 gcc 也都可以以编译成功。
相关文章推荐
- Lua1.0 写在最初
- torch.gt函数的用法
- 用lua 下载文件小示例
- Lua Math库的一些功能
- lua语言中矩阵下标为负值的含义
- 8.9.1 Controlling Query Plan Evaluation 控制查询评估
- 《Lua程序设计 第二版》学习笔记一
- lua闭包函数
- lua环境变量
- lua迭代
- Lua中关于求模与求余的区别介绍
- ULUA/CSTOLUA
- lua语言中与时间相关的函数总结
- Lua查找表元素过程(元表、__index方法是如何工作的)
- skynet学习一
- 机器学习模型评价(Evaluating Machine Learning Models)-主要概念与陷阱
- windows环境下用vs2012实现lua5.3.1的编译
- BabeLua LUA VS插件
- Lua中view函数的用法
- 用NDK编译lua库