1.1 --- a/core/smn_core.cpp Sat Jul 14 17:36:11 2007 +0000
1.2 +++ b/core/smn_core.cpp Sun Jul 15 01:04:34 2007 +0000
1.3 @@ -335,12 +335,6 @@
1.4 char *name;
1.5 uint32_t idx;
1.6 sp_context_t *ctx = pContext->GetContext();
1.7 - CPlugin *pl = g_PluginSys.GetPluginByCtx(ctx);
1.8 -
1.9 - if (!pl->IsInAskPluginLoad())
1.10 - {
1.11 - return pContext->ThrowNativeError("Calling MarkNativeAsOptional outside AskPluginLoad is not allowed");
1.12 - }
1.13
1.14 pContext->LocalToString(params[1], &name);
1.15 if (pContext->FindNativeByName(name, &idx) != SP_ERROR_NONE)
1.16 @@ -353,6 +347,19 @@
1.17 return 1;
1.18 }
1.19
1.20 +static cell_t RegPluginLibrary(IPluginContext *pContext, const cell_t *params)
1.21 +{
1.22 + char *name;
1.23 + uint32_t idx;
1.24 + CPlugin *pl = g_PluginSys.GetPluginByCtx(pContext->GetContext());
1.25 +
1.26 + pContext->LocalToString(params[1], &name);
1.27 +
1.28 + pl->AddLibrary(name);
1.29 +
1.30 + return 1;
1.31 +}
1.32 +
1.33 REGISTER_NATIVES(coreNatives)
1.34 {
1.35 {"AutoExecConfig", AutoExecConfig},
1.36 @@ -369,5 +376,6 @@
1.37 {"SetFailState", SetFailState},
1.38 {"FormatTime", FormatTime},
1.39 {"MarkNativeAsOptional", MarkNativeAsOptional},
1.40 + {"RegPluginLibrary", RegPluginLibrary},
1.41 {NULL, NULL},
1.42 };