diff --git a/core/interfaces/IShareSys.h b/core/interfaces/IShareSys.h index ec4bd997..997ff2d1 100644 --- a/core/interfaces/IShareSys.h +++ b/core/interfaces/IShareSys.h @@ -75,7 +75,9 @@ namespace SourceMod SMInterface **pIface) =0; /** - * @brief Adds a list of natives to the global native pool. + * @brief Adds a list of natives to the global native pool, to be bound on plugin load. + * NOTE: Adding natives currently does not bind them to any loaded plugins. + * You must manually bind late natives. * * @param token Identity token of parent object. * @param natives Array of natives to add. The last entry must have NULL members. diff --git a/core/systems/ShareSys.cpp b/core/systems/ShareSys.cpp index d1c1ac92..df8c719c 100644 --- a/core/systems/ShareSys.cpp +++ b/core/systems/ShareSys.cpp @@ -161,7 +161,7 @@ bool ShareSystem::RequestInterface(const char *iface_name, void ShareSystem::AddNatives(IExtension *myself, const sp_nativeinfo_t *natives) { - /* :TODO: implement */ + } void ShareSystem::DestroyIdentity(IdentityToken_t *identity) diff --git a/core/vm/sp_vm_basecontext.cpp b/core/vm/sp_vm_basecontext.cpp index 6b63ae53..fecfe427 100644 --- a/core/vm/sp_vm_basecontext.cpp +++ b/core/vm/sp_vm_basecontext.cpp @@ -432,7 +432,7 @@ uint32_t BaseContext::GetPubVarsNum() return ctx->plugin->info.pubvars_num; } -int BaseContext::BindNatives(sp_nativeinfo_t *natives, unsigned int num, int overwrite) +int BaseContext::BindNatives(const sp_nativeinfo_t *natives, unsigned int num, int overwrite) { uint32_t i, j, max; @@ -458,7 +458,7 @@ int BaseContext::BindNatives(sp_nativeinfo_t *natives, unsigned int num, int ove return SP_ERROR_NONE; } -int BaseContext::BindNative(sp_nativeinfo_t *native) +int BaseContext::BindNative(const sp_nativeinfo_t *native) { uint32_t index; int err; diff --git a/core/vm/sp_vm_basecontext.h b/core/vm/sp_vm_basecontext.h index 7ba4d0f6..f755335e 100644 --- a/core/vm/sp_vm_basecontext.h +++ b/core/vm/sp_vm_basecontext.h @@ -38,8 +38,8 @@ namespace SourcePawn virtual int PushCellArray(cell_t *local_addr, cell_t **phys_addr, cell_t array[], unsigned int numcells); virtual int PushString(cell_t *local_addr, char **phys_addr, const char *string); virtual int PushCellsFromArray(cell_t array[], unsigned int numcells); - virtual int BindNatives(sp_nativeinfo_t *natives, unsigned int num, int overwrite); - virtual int BindNative(sp_nativeinfo_t *native); + virtual int BindNatives(const sp_nativeinfo_t *natives, unsigned int num, int overwrite); + virtual int BindNative(const sp_nativeinfo_t *native); virtual int BindNativeToAny(SPVM_NATIVE_FUNC native); virtual int Execute(funcid_t funcid, cell_t *result); virtual void ThrowNativeErrorEx(int error, const char *msg, ...); diff --git a/sourcepawn/include/sp_vm_api.h b/sourcepawn/include/sp_vm_api.h index 3a3e01a8..cb904105 100644 --- a/sourcepawn/include/sp_vm_api.h +++ b/sourcepawn/include/sp_vm_api.h @@ -294,7 +294,7 @@ namespace SourcePawn * @param num Number of natives in array. * @param overwrite Toggles overwrite. */ - virtual int BindNatives(sp_nativeinfo_t *natives, unsigned int num, int overwrite) =0; + virtual int BindNatives(const sp_nativeinfo_t *natives, unsigned int num, int overwrite) =0; /** * @brief Binds a single native. Overwrites any existing bind. @@ -303,7 +303,7 @@ namespace SourcePawn * * @param native Pointer to native. */ - virtual int BindNative(sp_nativeinfo_t *native) =0; + virtual int BindNative(const sp_nativeinfo_t *native) =0; /** * @brief Binds a single native to any non-registered native.