Skip to content

Conversation

@soerlemans
Copy link
Owner

Adding support for converting parameters and passing these to C++ functions.
I should also add a more lean API for using the library from pure C (this might be horrendous and require implementation from the gobind side, with access to the headers and parsing those).

So the idea is to convert GType to a Golang type and cgo type for interacing with C native types.
Later we can support Structs that contain native types.
We can bypass any ABI compatibility issues, by retaining pointers to each member of a struct upon registration.
And then construct the struct using the same order of members specified.
(for this some kind of caster function would need to be made).
(this is not ideal, so another way must be found).

The development should be in baby steps, and soon we will need to do TDD for the entire pipeline to detect any anomalies since we are deep in ABI messing around territory.
For example I was curious how default parameters work in C++ and apparently the compiler just inserts the default argument at the call site of the function.

So if this is not encoded you get undefined behavior/unitialized data.
So safe to say we need to find a way to register default arguments.

The GobindModule struct is really starting to look like an AST slowly but surely.

@soerlemans soerlemans self-assigned this Apr 16, 2025
@soerlemans
Copy link
Owner Author

The PR body is more of a note to self, on how to architect/implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants