Small fixes for c++/weave code generation

Tests pass on Windows.