added some helper definitions

done:
* added helper definitions
* formatting (pedantry)

todo:
* test windows linker code
* add better windows error codes
* test new helper definitions
* add better windows error messages
* possible support for reference counting in factory function
definitions