Mapping a C structure to berry object at runtime. Is it possible? #455
Unanswered
BennyEvans
asked this question in
Q&A
Replies: 1 comment
-
Ive wrapped my head around this all a bit more now and have something working following the same methodology as the file lib. I store a pointer to the actual C structure in a member called ".p" and then have function members on the class that access/mutate the C structure. Not sure if there is a better way, but this seems to work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a C structure that I'd like to register as a class without using any of the solidification functionality. For example, if I had a structure like this below:
typedef struct _point_s { int x; int y; } point_t;
And then some native functions such as:
point_t get_latest_point(); void do_something_with_point(point_t point);
After creating a new vm at runtime, I'd like to create a class "Point" using the C API that can be used in berry scripts and it's members accessed. I then want to register native C functions that can work on the class. Is this possible and if so, may someone please provide an example.
Thankyou for your help.
Regards,
Ben
Beta Was this translation helpful? Give feedback.
All reactions