-
Notifications
You must be signed in to change notification settings - Fork 2
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
Box arguments taking into consideration deep pointers #34
Conversation
such as sometimes used in GStreamer
cc13bed
to
3a97c4c
Compare
I've also added various array tests for strings like strings, GTypes, etc... I think this should be reviewed so that I can start working on the next batch of tests |
running gstreamer example results in segmentation fault |
you're right. this is due to GStreamer's insistence on passing everything as pointers. working on it |
Hello. I haven't been able to diagnose what's wrong with GStreamer and I would suggest we merge this as-is (probably removing the gstreamer code) as other parts work. This would allow us to iterate on other parts faster. |
ping |
so is this ready to merge now? |
Yes, I guess. The GStreamer demo will still be (intentionally) broken though. |
hello @vixalien since I don't have enough time to maintain this project alone, and you did a great job with your contributions, I wanted to add you as a collaborator so you could merge and maintain codes. are you okay with that? |
Hello. no worries. Do you have a matrix account or other chat so that we can communicate more easily? |
I'm not active on matrix. you can reach me via email [email protected] or telegram ahgilak |
In GI, some values are nested in pointers, while others are not.
Direct values (no pointers)
For example, given a function like the following:
To unbox the value above, you will just need to do
dataView.getFloat64()
.pointers
This is usually common in outArgs
To unbox the argument above, we need to get the value pointed to, and then finally get the value.
Doubly pointed to values
While extremely rare, it is possible that values are contained in a pointer to a pointer. To check for these values, we use
GITypeInfo.is_pointer
. Here is an example of this usage: https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/main/tests/scanner/regress.c?ref_type=heads#L647Because
out
(andinout
) arguments are already pointers, if such an argument hasis_pointer()
set to true, it effectively means it's a pointer to a pointer.To unbox these values, we need to double get the value, as implemented in this PR with a new value called
nPointers
.I've also added a GStreamer example, as that should be interesting...