加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

链接器 – Luajit:将字节码编译为对象格式

发布时间:2020-12-14 21:44:15 所属栏目:大数据 来源:网络整理
导读:关于-b选项的Luajit手册说: The output file type is auto-detected from the extension of the output file name: c — C source file,exported bytecode data. h — C header file,static bytecode data. obj or o — Object file,exported bytecode data
关于-b选项的Luajit手册说:

The output file type is auto-detected from the extension of the output file name:

  • c — C source file,exported bytecode data.
  • h — C header file,static bytecode data.
  • obj or o — Object file,exported bytecode data (OS- and architecture-specific).
  • raw or any other extension — Raw bytecode file (portable).

将它编译为目标文件意味着什么?我知道它生成一个文件,然后可以与从C或C代码生成的其他目标文件链接.

但这是如何工作的?如何使用其他C代码生成的目标文件?在哪种情况下你会这样做?

解决方法

它将模块的字节码嵌入到常量数组中.

如果然后从可执行文件或共享库中导出此数组,则require将能够在那里找到它(因此不需要搜索.lua源文件.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读