added a quick experimental system for overriding core natives

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401695
This commit is contained in:
David Anderson
2007-11-17 04:31:01 +00:00
parent dfa007081b
commit a79a169384
8 changed files with 141 additions and 3 deletions
+4 -1
View File
@@ -127,8 +127,11 @@ namespace SourceMod
/**
* @brief Version code of the IExtensionInterface API itself.
*
* Note: This is bumped when IShareSys is changed, because IShareSys
* itself is not versioned.
*/
#define SMINTERFACE_EXTENSIONAPI_VERSION 2
#define SMINTERFACE_EXTENSIONAPI_VERSION 3
/**
* @brief The interface an extension must expose.
+23
View File
@@ -200,6 +200,29 @@ namespace SourceMod
* @param name Library name.
*/
virtual void RegisterLibrary(IExtension *myself, const char *name) =0;
/**
* @brief Adds a list of natives to the global native pool, to be
* bound on plugin load.
*
* Unlike AddNatives(), this function implements natives that are
* ALWAYS bound, regardless of whether a previous function is bound.
* That means extensions can override Core natives.
*
* A Core version of each native must exist. If one does not, then
* Core will simply ignore that entry.
*
* Override natives represent a weak coupling. If the extension is
* unloaded, the native will be re-bound to the Core version.
*
* @param myself Identity token of parent object.
* @param natives Array of natives to add. The last entry in
* the array must be filled with NULLs to
* terminate the array. The array must be static
* as Core will cache the pointer for the
* lifetime of the extension.
*/
virtual void OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives) =0;
};
}