Change backend to deal with globals
Add export header and export macros when needed