Fix compilation problems in DragonFly BSD 3.4 or higher.

Library kind of works, as per the tests done in examples. It will require further checks.