Linux-like shared object linking behavior on OSX

See:

http://stackoverflow.com/questions/3695234/what-is-the-deal-with-undefined-symbols-in-a-shared-library-or-dylib
http://stackoverflow.com/questions/1933667/accessing-main-program-global-variables-from-a-dlopened-dynamic-library-in-c-o
Add missing include