Patch for shared.c to build dynamic library on OSX.