On Mon, Jul 25, 2016 at 11:18 AM, Joosep Pata <[email protected]> wrote: > >> I was under the impression that by "patch repl.c" you mean to patch it >> somehow so that you can compile as a shared library, that will be very >> bad and is intentionally not supported. >> If you are talking about adding your llvm initialization stuff in this >> file and compile it still as an executable and if you current goal is >> to get a julia binary that does not confuse LLVM then I think that's >> the best way to do it and the approach itself is not "dirty" at all >> (apart from possibly dirty things you need to do to "unconfuse" LLVM, >> which you need to do anyway, independent of where you do it). > > Yes, that's what I wanted to do (re-compile the julia binary with my preinit > code), sorry for not being clear. If only 3 (or some N<10) lines of code was > needed to make a fully functional julia binary using libjulia, I suppose > repl.c would be a bit shorter as well.
Well, this IS actually the case. Most of the logic in `repl.c` are actually not necessary for a working julia binary. Many of them (in terms of line count) are actually only needed during (or even only for debugging) bootstrapping. In another word, `true_main` should basically only contain one `jl_set_ARGS` and one `jl_eval_string` if it doesn't need to support bootstrapping. > > In fact, I found the way to implement what I needed also via dlopening > libjulia [1] as you suggested, but having a non-standard location for the > julia binary (wrt. julia source tree) is a real pain, so I think I'll just go > with the patch-and-recompile-binary approach. > > Thanks again for the clarifications! > > [1] https://github.com/jpata/ROOT.jl/blob/cxx/src/ui.cc
