You know, I was looking at the PyGobject code, which basically does the same thing. It looks at the methods and properties and such and creates the object at that time. I'll look at that, that would probably be best. I'm hoping to get some demonstration code soon... The documentation for gobject introspection doesn't seem very good, more about making your own glib types and classes be able to be introspected, rather than how to use introspection in your own code for calling methods from existing classes. I did see something on how ruby created bindings for gtk, and how you can use it in your language, so I'll try to find that again, in addition to looking at the python source.... It will be a while before this gets to the point of pygobect, that code does a lot of stuff, including creating new gobject types dynamically based on python code. On Saturday, May 26, 2018, 2:19:22 PM EDT, H. William Welliver III william@welliver.org wrote:
When I wrote an Objective-C bridge, I used introspection at class creation time: I overloaded ObjectiveC->`[]() so that when, for example, ObjectiveC.NSObject was accessed, a c-method performed introspection of the NSObject class and created a program dynamically using the C level module API: start_new_program() and friends. Methods were trampolines generated using libffi This provided relatively good runtime speed of method calls (as they were c methods that used libffi combined with the objective-c API) without the overhead of performing `[] and introspection on each method call. I also built a system of overlays that could provide custom mixing methods for situations where the generic binding wouldn’t suffice. Perhaps something like this could be used to provide optimal performance? Bill
On May 26, 2018, at 11:34 AM, Lance Dillon riffraff169@yahoo.com wrote: Yeah, that's what the gtk2 module does, I'm wondering if I can add functions to a class (in the c code) that has already been created and ended using end_program().
Sent from Yahoo Mail on Android
On Sat, May 26, 2018 at 11:14 AM, Stephen R. van den Bergsrb@cuci.nl wrote: Lance Dillon wrote:
Which brings up a question:?? is it possible to add a method to a class that has already started and ended (using start_new_program() and end_program()).
Overloading the `-> operator should work.