Static lib

Added a Static library target. Made demo project use it.
Fixed possible low level leaks by using STL.

Provided more types consistency by using C++ casts.