Minor fixes.

1) fixed warning about discarding const qualifier
2) fixed linkage with c++ code