Lisp 可执行文件 [英] Lisp Executable

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

问题描述

我刚刚开始学习 Lisp,我不知道如何编译 lisp 代码并将其链接到可执行文件.

I've just started learning Lisp and I can't figure out how to compile and link lisp code to an executable.

我使用 clispclisp -c 生成两个文件:

I'm using clisp and clisp -c produces two files:

  • .fas
  • .lib

接下来我该怎么做才能获得可执行文件?

What do I do next to get an executable?

推荐答案

我今天实际上正在尝试这样做,我发现将其输入到 CLisp REPL 中有效:

I was actually trying to do this today, and I found typing this into the CLisp REPL worked:

(EXT:SAVEINITMEM "executable.exe"
                 :QUIET t
                 :INIT-FUNCTION 'main
                 :EXECUTABLE t
                 :NORC t)

其中 main 是程序启动时要调用的函数的名称,:QUIET t 抑制启动横幅,:EXECUTABLE t 生成本地可执行文件.

where main is the name of the function you want to call when the program launches, :QUIET t suppresses the startup banner, and :EXECUTABLE t makes a native executable.

调用

(EXT:EXIT)

在 main 函数的末尾,以防止用户在程序完成时收到交互式 lisp 提示.

at the end of your main function in order to stop the user from getting an interactive lisp prompt when the program is done.

阅读文档,您可能还想添加 :NORC t(阅读链接).这会抑制加载 RC 文件(例如,~/.clisprc.lisp).

Reading the documentation, you may also want to add :NORC t (read link). This suppresses loading the RC file (for example, ~/.clisprc.lisp).

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

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