The proper way to do it is to export all shared classes and functions into a shared library that is linked by both the main application and the plugins.