Loading a macro in ROOT6 with external ROOTified library

Try the R__LOAD_LIBRARY macro:

R__LOAD_LIBRARY(libMyLibrary)
Int_t myMacro( ) {
    // your code here
}

See older threads, for example Shared libraries and ROOT-6