wickwirew / Runtime

A Swift Runtime library for viewing type info, and the dynamic getting and setting of properties.
MIT License
1.08k stars 94 forks source link

Calling function of a class #63

Closed alexsteinerde closed 4 years ago

alexsteinerde commented 4 years ago

Hey, great library! But is it also possible to call a function of an object with parameters?

wickwirew commented 4 years ago

I actually worked on this a few days ago. I can get a pointer to the vtable and all get of the symbol names, however there is no way to demangle them unfortunately, so they are kind of useless.

I saw a proposal to add a demangle function to the stdlib, but no progress has been made on it. Until then I don’t see a way to do it.

alexsteinerde commented 4 years ago

Ok thanks for the answer. So I think as this not possible at the moment I'll close the issue until I hear something new in the Swift forum about function reflection.

starFelix commented 2 years ago

I actually worked on this a few days ago. I can get a pointer to the vtable and all get of the symbol names, however there is no way to demangle them unfortunately, so they are kind of useless.

I saw a proposal to add a demangle function to the stdlib, but no progress has been made on it. Until then I don’t see a way to do it.

@wickwirew How to get method list of one instance?