165 {
167 if (!modulePath)
168 {
169 errorDescription = inPath + " is not a module directory.";
170 return false;
171 }
172
173 mModule = dlopen (
reinterpret_cast<const char*
> (modulePath->generic_string ().data ()),
174 RTLD_LAZY);
176 {
177 errorDescription = "dlopen failed.\n";
178 errorDescription += dlerror ();
179 return false;
180 }
181
182 auto moduleEntry = getFunctionPointer<ModuleEntryFunc> ("ModuleEntry");
183 if (!moduleEntry)
184 {
185 errorDescription =
186 "The shared library does not export the required 'ModuleEntry' function";
187 return false;
188 }
189
190 auto moduleExit = getFunctionPointer<ModuleExitFunc> ("ModuleExit");
191 if (!moduleExit)
192 {
193 errorDescription =
194 "The shared library does not export the required 'ModuleExit' function";
195 return false;
196 }
197 auto factoryProc = getFunctionPointer<GetFactoryProc> ("GetPluginFactory");
198 if (!factoryProc)
199 {
200 errorDescription =
201 "The shared library does not export the required 'GetPluginFactory' function";
202 return false;
203 }
204
206 {
207 errorDescription = "Calling 'ModuleEntry' failed";
208 return false;
209 }
210 auto f = Steinberg::FUnknownPtr<Steinberg::IPluginFactory> (owned (factoryProc ()));
211 if (!f)
212 {
213 errorDescription = "Calling 'GetPluginFactory' returned nullptr";
214 return false;
215 }
217 return true;
218 }
static Optional< Path > getSOPath(const std::string &inPath)