Merge pull request #587 from dawgfoto/refactorMain

reuse rt_init/rt_term in main
Merge pull request #589 from dawgfoto/threadTermLocks

add explicit thread_term call to replace atexit
perform runtime and module initialization when loading DSOs
Merge pull request #590 from dawgfoto/autoInit

perform runtime and module initialization when loading DSOs