Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion binding_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1831,7 +1831,13 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
for value in class_api["constants"]:
if "type" not in value:
value["type"] = "int"
result.append(f"\tstatic const {value['type']} {value['name']} = {value['value']};")
const_value = value["value"]
if value["type"] == "int" and const_value == -2147483648:
# -2147483648 is a valid value for int, but MSVC doesn't read the whole thing as a literal,
# instead it sees 2147483648 (which is too big for an an int) and then applies the unary minus.
# This is a workaround for that.
const_value = "-2147483647 - 1"
result.append(f"\tstatic const {value['type']} {value['name']} = {const_value};")
result.append("")

if is_singleton:
Expand Down
Loading