Fix incorrect hardcoded requirement for libdl

Not all platforms, for example FreeBSD, require linking against libdl.
Cmake provides the variable CMAKE_DL_LIBS which should contain
platform-appropriate libraries. This patch replaces the use of 'dl'
with this variable, and updates the documentation to reflect the actual
requirements for compilation on FreeBSD.
Fix a couple compile warnings
Merge pull request #35 from tpz/master

Fix incorrect hardcoded requirement for libdl
Explicitly cast void to FILE*. Fixes #32
Merge branch 'fix_small_errors'
Fix #33 and close #34 with alternative fix