149 {
150 auto wideStr = StringConvert::convert (inPath);
151 mModule = LoadLibraryW (
reinterpret_cast<LPCWSTR
> (wideStr.data ()));
153 {
154 filesystem::path p (inPath);
155 auto filename = p.filename ();
156 p /= "Contents";
158 p /= filename;
159 wideStr = StringConvert::convert (p.string ());
160 mModule = LoadLibraryW (
reinterpret_cast<LPCWSTR
> (wideStr.data ()));
162 {
163 auto lastError = GetLastError ();
164 LPVOID lpMessageBuffer;
165 FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
166 nullptr, lastError, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
167 (LPSTR)&lpMessageBuffer, 0, nullptr);
168 errorDescription = "LoadLibray failed: " + std::string ((char*)lpMessageBuffer);
169 LocalFree (lpMessageBuffer);
170
171 return false;
172 }
173 }
174 auto factoryProc = getFunctionPointer<GetFactoryProc> ("GetPluginFactory");
175 if (!factoryProc)
176 {
177 errorDescription = "The dll does not export the required 'GetPluginFactory' function";
178 return false;
179 }
180
181 auto dllEntry = getFunctionPointer<InitModuleFunc> ("InitDll");
182 if (dllEntry && !dllEntry ())
183 {
184 errorDescription = "Calling 'InitDll' failed";
185 return false;
186 }
187 auto f = Steinberg::FUnknownPtr<Steinberg::IPluginFactory> (owned (factoryProc ()));
188 if (!f)
189 {
190 errorDescription = "Calling 'GetPluginFactory' returned nullptr";
191 return false;
192 }
194 return true;
195 }
constexpr auto architectureString