fix double definition error (for c++) and cast to void* warning in -pedantic flag