Previously, since tree_sitter_v was not declared on the C side (it is only when the .c file is compiled, but was missing in the V wrapper), the C compiler just assumed it returns an int and casted the pointer to an int, which works for small pointers < 2^32 , but only incidentally.
Now, by including tree_sitter/parser.h in the V wrapper too (through bindings.h), and declaring the exact signature of that function, the C compiler knows that function returns a pointer instead (i.e. potentially a 64bit value > 2^32), so it does not cast it.
Previously, since
tree_sitter_v
was not declared on the C side (it is only when the .c file is compiled, but was missing in the V wrapper), the C compiler just assumed it returns an int and casted the pointer to an int, which works for small pointers < 2^32 , but only incidentally.Now, by including
tree_sitter/parser.h
in the V wrapper too (through bindings.h), and declaring the exact signature of that function, the C compiler knows that function returns a pointer instead (i.e. potentially a 64bit value > 2^32), so it does not cast it.