Attaching functions to a class/struct
I'm doing a little experimenting with a COM-like structure but I'm not using COM per se.
The goal is to be able to add functions to a class/struct or whatever dynamically at run-time.
void Attach(void *Func);
void Attach(void **FuncList,int numfuncs);
Problem is to call these funcs I would have to create a special call function. I would rather call these functions just as you would in normal C code. But, the struct does not 'know' what functions it has nor does it know the prototypes for thoe functions. Essentially I must create my own vtable for this to work. Upon querying the object it should return a pointer to the interface for the object. Sort of like COM. I'm working on this for possible implementation in a new OS and since COM is copyrighted it would not serve to use it.
The goal is to be able to dynamically attach and detach functions via pointers to and from objects. Perhaps I need to read a book on COM to see how it truly functions underneath the hood - using it and coding something like it are 2 completely diff things.
And even though the GUID system works for COM I'm not a big fan of it so I would need a way to uniquely identify each object. I know these objects must be pre-compiled and sitting somehwhere for someone to use. As well there must be a mechanism for retrieving pointers to these objects - but this function can not be relative to the object being used. Very simple concept but very confusing.