| 37 | MyExtension g_SMExt; |
| 38 | |
| 39 | bool SM_LoadExtension(char *error, size_t maxlength) |
| 40 | { |
| 41 | if ((smexts = (IExtensionManager *)g_SMAPI->MetaFactory( |
| 42 | SOURCEMOD_INTERFACE_EXTENSIONS, |
| 43 | NULL, |
| 44 | NULL)) |
| 45 | == NULL) |
| 46 | { |
| 47 | if (error && maxlength) |
| 48 | { |
| 49 | UTIL_Format(error, maxlength, SOURCEMOD_INTERFACE_EXTENSIONS " interface not found"); |
| 50 | } |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | /* This could be more dynamic */ |
| 55 | char path[256]; |
| 56 | g_SMAPI->PathFormat(path, |
| 57 | sizeof(path), |
| 58 | "addons/myplugin/bin/myplugin%s", |
| 59 | #if defined __linux__ |
| 60 | "_i486.so" |
| 61 | #else |
| 62 | ".dll" |
| 63 | #endif |
| 64 | ); |
| 65 | |
| 66 | if ((myself = smexts->LoadExternal(&g_SMExt, |
| 67 | path, |
| 68 | "myplugin_mm.ext", |
| 69 | error, |
| 70 | maxlength)) |
| 71 | == NULL) |
| 72 | { |
| 73 | SM_UnsetInterfaces(); |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | return true; |
| 78 | } |
| 79 | |
| 80 | void SM_UnloadExtension() |
| 81 | { |
no test coverage detected