Got it! You can pass a source file the same way as a library -l
.
repl:
cling -std=c++11 -lcling_init.cpp -llibpq.so -lliblog4cxx.so //etc ...
Fyi you also need to put the entire library names for it to work.
For doing additional setup I had to use a static block:
#include <iostream>
struct ClingInitialize {
ClingInitialize () {
std::cout << "initialize" << std::endl;
}
};
static ClingInitialize staticBlock;