Extensions that call sharesys->RegisterLibrary don't trigger OnLibraryAdded unless they are reloaded.
SourceMod Version Information:
SourceMod Version: 1.12.0.7140
SourcePawn Engine: 1.12.0.7140, interp-x86 (build 1.12.0.7140 NO JIT)
SourcePawn API: v1 = 5, v2 = 16
Compiled on: May 21 2024 12:31:10
Built from: 0f588b87
Build ID: 7140:0f588b87
http://www.sourcemod.net/
Example
public Extension __ext_testlib =
{
name = "testlib",
file = "testlib.ext",
autoload = 1,
required = 0,
};
native void TestNative();
public void __ext_testlib_SetNTVOptional()
{
MarkNativeAsOptional("TestNative");
}
public void OnLibraryAdded(const char[] name)
{
PrintToServer("OnLibraryAdded %s", name); // doesn't show testlib unless you reload the extension
}
public void OnAllPluginsLoaded()
{
PrintToServer("loaded: %i", LibraryExists("testlib")); // always works
}
void Sample::SDK_OnAllLoaded()
{
sharesys->RegisterLibrary(myself, "testlib"); // doesn't matter if you put this here or on SDK_OnLoad
sharesys->AddNatives(myself, g_natives);
}
Extensions that call sharesys->RegisterLibrary don't trigger OnLibraryAdded unless they are reloaded.
SourceMod Version Information:
SourceMod Version: 1.12.0.7140
SourcePawn Engine: 1.12.0.7140, interp-x86 (build 1.12.0.7140 NO JIT)
SourcePawn API: v1 = 5, v2 = 16
Compiled on: May 21 2024 12:31:10
Built from: 0f588b87
Build ID: 7140:0f588b87
http://www.sourcemod.net/
Example