Added explicit casts.
Compile everything with "g++" and link statically.