Plugin Interface Change for 1.6.2 (yet again..)
-
To keep everyone in the loop to what Im doing in this branch of the FLHook plugin svn:
For version 1.6.2 I want to change the plugin interface yet again. I know this should’ve been done when switching to reading the plugin info out of the dll, but oh well I just didnt have the time.
Now, what am I changing and why?First the motivation: We’ve got multiple occasions in FLHook where we would like to have plugins callback into code at more than one position within the same function (note the _AFTER callbacks). This is currently only possible by creating a dummy function and then call plugins from there because of how we identify a callback (with the FUNCDNAME macro). Also, it requires plugin devs to use the same function names and name spaces as they appear in FLHook.
Also, there is an overhead in actually finding plugins via a map-search. I know this is basically negligible because its O(log n), but O(1) is better and generally nicer.So what’s the idea?
First thing is that plugins no longer pass strings to FLHook in their info call, rather they pass function pointers to the callback functions directly. This is straight forward. Now, callbacks will be identified via an enum. This enum is nothing else than an array from 0 to [number_of_callbacks]. Therefore, we can use it for an array of callback lists for every function. This numeric identifier also allows us to easily do more than one callback in one original flhook function (also do custom callbacks with custom arguments). It also gives plugin devs the liberty to use their own names and namespaces. There also were problems compiling when hooking the iclientimpl functions, this should be solved this way as well.@devs: I hope you understand my intentions. Any comments/suggestions?
-
Do it and merge it into the main trunk don’t bother with the branch.
This will result in a fairly good performance improvement I think.
I’d just call this 1.6.1 rather than 1.6.2 although I wonder if we should jump to 2.0 or 1.7 because of the confusion with the flak-hook which is also in the 1.6.x series.
-
I like 1.7. I think it’s a fairly substantial improvement to FL Hook and would also help with the confusion between the Hooks, as you mentioned, Cannon.
-
That works, too