[luatex] LuaTeX as a Library

Nicolas Holzschuch Nicolas.Holzschuch at inria.fr
Sun Nov 19 17:47:18 CET 2017

Hello fellow LuaTeX users, 

This is slow-moving thread...

> On 11 Oct 2017, at 15:19, Patrick Gundlach <patrick at gundla.ch> wrote:
> Hello Nicolas,
> of course I should have quoted the email...
> The question was about building a shared library (.so, .dylib, .dll - I hope I've got the correct term) of LuaTeX. For my experiments I'd only need a Mac (latest OS, 64 bit) version.
> Here is the original mail:
> http://tug.org/pipermail/luatex/2016-February/005698.html

Since it seems there is a demand, and I've reached a point where the library is useable. Here is my port of LuaTeX-as-a-library. I wrote it mostly for iOS, but it works on other systems too:


Compilation is through "./build_command.sh" (basically Build, but deactivating all the modules, except lualatex, bibtex and pdflatex). If you're not compiling for iOS, you will need to edit the Makefiles a bit. I'm open to suggestions in how to make the changes more compatible with other platforms.

It provides several dynamic libraries (for bibtexu, for pdflatex, for lualatex, for kpathsea...), and gives access to three functions: 

extern int bibtex_main(int argc, char *argv[]);
extern int dllluatexmain(int argc, char *argv[]);
extern int dllpdftexmain(int argc, char *argv[]);

You call the functions as you would call the corresponding binary. For example: 

dllluatexmain(3, "lualatex", "--interaction=nonstopmode", "myFile.tex");

is the equivalent of "lualatex --interaction=nonstopmode myFile.tex"


More information about the luatex mailing list