changed templates to cpp #if, produced new macor to ease plugin creation, cleaned up C linkage