the difference in the two cases is that in the former setup you interpret the code with CINT, while in the second you compile a shared library and you call a function provided by it via a stub function contained in the dictionary aclic automatically generates.
A possible way out is to use the gcc/clang preprocessor macro FILE, for example