Updated to produce working shared objects and executables (might need more stuff for Windows)