In C I could write a plugin by having a shared library implement the following interface:
extern "C" int initialize(SomeArgument * state);
extern "C" int shutdown(SomeArgument * state);
Obviously this is a very high level interface, but I think it gets the point across. I've heard that a good use of reflection is to write plugins, but why would that be superior to what I have here? Using an interface like this gives the following advantages:
- faster (reflection isn't fast, both looking up methods and calling indirectly)
- memory (reflection has memory overhead)
- straight-forward (entry/exit points for the plugin are intuitively obvious)
Am I just missing something?
No comments:
Post a Comment