imageworks/OpenShadingLanguage — pull request #374 by lgritz (2014-06-10 16:32:43+00:00)
Title: Eliminate clunky dlopen trick that was needed to make OSL work from DSOs.

As previously illustrated in testshade_dso.cpp, on Linux we needed to force a dlopen of liboslexec.so with the right flags, all for the sake of ensuring that LLVM could find any compiled-in C functions that we needed to make calls to from the IR, in the case that the whole OSL system was itself a DSO (like a plugin to another app).

The solution is to rely on an LLVM function, InstallLazyFunctionCreator, whose job is to return function pointers for calls whose functions LLVM can't find any other way. But to do that, we needed a table of all such functions, and that required a bit of refactoring of the big function table in llvm_instance.cpp. In the process, I moved the bulk of the table to be in a new header, builtindecl.h, that made it easier because I needed extern declarations separate from the table entries.