| 111 | } |
| 112 | |
| 113 | bool |
| 114 | plugin_dso_load(const char *path, void *&handle, void *&init, std::string &error) |
| 115 | { |
| 116 | handle = dlopen(path, RTLD_NOW); |
| 117 | init = nullptr; |
| 118 | if (!handle) { |
| 119 | error.assign("unable to load '").append(path).append("': ").append(dlerror()); |
| 120 | Error("%s", error.c_str()); |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | init = dlsym(handle, "TSPluginInit"); |
| 125 | if (!init) { |
| 126 | error.assign("unable to find TSPluginInit function in '").append(path).append("': ").append(dlerror()); |
| 127 | Error("%s", error.c_str()); |
| 128 | dlclose(handle); |
| 129 | handle = nullptr; |
| 130 | return false; |
| 131 | } |
| 132 | |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | static bool |
| 137 | single_plugin_init(int argc, char *argv[], bool validateOnly) |
no test coverage detected