Hi,
As the first step of interpreting, cling “compiles” that script before running it. For that it cannot resolve the foo
constructor. I.e. things are out of sequence. Simply use
R__ADD_LIBRARY_PATH($FOODIR) // if needed
R__LOAD_LIBRARY(libFoo.dylib)
right after the #include
and it should work.
Cheers, Axel.