+2  A: 

No, this is the preferred way of doing it, in my opinion. Any other way that I can think of involves making the DLL aware of the objects in the program it's linked with, which is most likely bad practice.

Regarding data, just a reminder though you didn't ask, it's usually best practice to copy any data that needs to be stored, if it's passed across library/program boundaries. You can get into a complete mess if you have the library using data whose lifetime is controlled by the program, and vice versa.

dauphic
Thank you very much
It's because I would like to enable the use of the same logger (log4cxx) in both main and the dynamic library.
In that case, a callback is definitely a way to go.
dauphic