Merge pull request #6656 from m0hamed/fix_export

Simplify template exporting macros