Add FreeBSD defines
Include stddef.h for ptrdiff_t on FreeBSD
Add an explicit cast to shut up g++47 on FreeBSD
There's no libdl on FreeBSD