Move visibility macros to a separate file

Reduce noise in the header by having the same boilerplate repeated over
and over again.