genbindings: allow compilation if we return a const void*

This commit is contained in:
mappu 2024-08-10 11:46:27 +12:00
parent 05804f837e
commit bc3bfa88ad

View File

@ -233,6 +233,8 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
afterCall = "\t// Copy-construct value returned type into heap-allocated copy\n" afterCall = "\t// Copy-construct value returned type into heap-allocated copy\n"
afterCall += "\treturn static_cast<P" + m.ReturnType.ParameterType + ">(new " + m.ReturnType.ParameterType + "(ret));\n" afterCall += "\treturn static_cast<P" + m.ReturnType.ParameterType + ">(new " + m.ReturnType.ParameterType + "(ret));\n"
} else if m.ReturnType.Const {
shouldReturn += "(" + emitReturnTypeCabi(m.ReturnType) + ") "
} }
preamble, forwarding := emitParametersCABI2CppForwarding(m.Parameters) preamble, forwarding := emitParametersCABI2CppForwarding(m.Parameters)