15
I am by far a person that can give you an authorative answer. As I have written in a comment to David, there is no way to use TeX as a (shared) library. But you can use LuaTeX to load modules and execute LuaTeX's functions.
Say you want to call texio.write_nl("Hello world!"). You have to write a...