Not-Nik / raylib-zig

Manually tweaked, auto-generated raylib bindings for zig. https://github.com/raysan5/raylib
MIT License
459 stars 101 forks source link

fixed pointer cast that discards const qualifier #75

Closed KeanBuyst closed 3 months ago

KeanBuyst commented 3 months ago

[]const Vector2 converted to [*c]Vector2 which discards the const qualifier. Which throws an error.

I removed the const from []const Vector2 which fixed the issue. If you want to keep the const you can either use @constCast or change [*c]Vector2 to [*c]const Vector2 and also change cdef counter part to also [*c]const Vector2 which may work. I haven't tested the last one.

There might be more functions also effected, but the ones I changed were the ones I located.

Not-Nik commented 3 months ago

I'd rather leave the [] const Vector2, but I don't have a testing project to try out if [*c]const Vector2 works. I'll leave this open until I find some time.

KeanBuyst commented 3 months ago

I changed it to [*c]const and I tested it. No errors works just fine.

Not-Nik commented 3 months ago

Sorry, I didn't check what C does and since it doesn't make any const promises either, your first approach was correct

KeanBuyst commented 3 months ago

Ok no problem