-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gint64 array length parameters cause invalid cast error #1098
Comments
Hey, thanks for the report. I did not yet take a detailed look at this bug but it can be that there is no easy fix for it and needs updating the typehandling of the generator. Gint64 is guaranteed to be 64 bits on all platforms. The GirLoader maps Gint64 to long. The This is obviously wrong for GInt64 as it has 64Bit on all platforms. So either there must be a new Type like I need to take a more detailed look here. |
Ah good point, yeah |
GirModel.CLong is 32 bit on all windows platforms, 32 bit on 32 bit unix platforms and 64 bit on 64bit unix platforms. GirModel.Long ist 64 bit on all platforms. This reverts the changes from #1067 and only adds the CLong / CULong handling for "glong" / "gulong". All other long types stay like originally intended. Fixes #1098
GirModel.CLong is 32 bit on all windows platforms, 32 bit on 32 bit unix platforms and 64 bit on 64bit unix platforms. GirModel.Long ist 64 bit on all platforms. This reverts the changes from #1067 and only adds the CLong / CULong handling for "glong" / "gulong". All other long types stay like originally intended. Fixes #1098
GirModel.CLong is 32 bit on all windows platforms, 32 bit on 32 bit unix platforms and 64 bit on 64bit unix platforms. GirModel.Long ist 64 bit on all platforms. This reverts the changes from #1067 and only adds the CLong / CULong handling for "glong" / "gulong". All other long types stay like originally intended. Fixes #1098
@adamreeve This should be fixed again. Thanks for reporting. I added your test scenario to the tests, too. |
👍 thanks for fixing this! |
Since #1067 was merged, I now get errors building bindings for methods where the array length has type
gint64
. I've pushed a change to the GirTest library to reproduce the error here: adamreeve@f93b90fThe generated method looks like:
The expected type of the length parameter to the internal method is
CLong
rather thanlong
, which causes errors when building the generated code like:This appears to be due to the
PrimitiveValueTypeArray
implementation ofToNativeParameterConverter
here:gir.core/src/Generation/Generator/Renderer/Public/ParameterToNativeExpression/Converter/PrimitiveValueTypeArray.cs
Line 56 in 7c1b5a8
But I haven't yet figured out how best to fix this. I guess we want to reuse the
Long
instance ofToNativeParameterConverter
rather than hard code the cast here?The text was updated successfully, but these errors were encountered: