문제

The Luajit manual about the -b option says:

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).

What does it mean to compile it to object file? I know it produces a file which then can be linked with other object files generated from C or C++ code.

But how does this work? How would one use the generated object file from other C code? And in which situation would you do it?

도움이 되었습니까?

해결책

It embeds the bytecode for a module into a constant array.

If you then export this array from the executable or a shared library, require will be able to find it there (and thus not need to search for the .lua source file.)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top