diff -r 003e822e8a46 -r 152ceef17866 core/smn_core.cpp --- a/core/smn_core.cpp Sat Jul 14 17:36:11 2007 +0000 +++ b/core/smn_core.cpp Sun Jul 15 01:04:34 2007 +0000 @@ -335,12 +335,6 @@ char *name; uint32_t idx; sp_context_t *ctx = pContext->GetContext(); - CPlugin *pl = g_PluginSys.GetPluginByCtx(ctx); - - if (!pl->IsInAskPluginLoad()) - { - return pContext->ThrowNativeError("Calling MarkNativeAsOptional outside AskPluginLoad is not allowed"); - } pContext->LocalToString(params[1], &name); if (pContext->FindNativeByName(name, &idx) != SP_ERROR_NONE) @@ -353,6 +347,19 @@ return 1; } +static cell_t RegPluginLibrary(IPluginContext *pContext, const cell_t *params) +{ + char *name; + uint32_t idx; + CPlugin *pl = g_PluginSys.GetPluginByCtx(pContext->GetContext()); + + pContext->LocalToString(params[1], &name); + + pl->AddLibrary(name); + + return 1; +} + REGISTER_NATIVES(coreNatives) { {"AutoExecConfig", AutoExecConfig}, @@ -369,5 +376,6 @@ {"SetFailState", SetFailState}, {"FormatTime", FormatTime}, {"MarkNativeAsOptional", MarkNativeAsOptional}, + {"RegPluginLibrary", RegPluginLibrary}, {NULL, NULL}, };