192 unsigned long (*versionFunc)();
193 versionFunc =
reinterpret_cast<decltype(versionFunc)
> (
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_VERSION));
195 _version = (*versionFunc)();
196 if (ModelLibraryCSourceGen<Base>::API_VERSION != _version)
197 throw CGException(
"The API version of the dynamic library (", _version,
198 ") is incompatible with the current version (",
199 ModelLibraryCSourceGen<Base>::API_VERSION,
")");
204 void (*modelsFunc)(
char const *
const**,
int*);
205 modelsFunc =
reinterpret_cast<decltype(modelsFunc)
> (
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_MODELS));
207 char const*
const* model_names =
nullptr;
209 (*modelsFunc)(&model_names, &model_count);
211 for (
int i = 0; i < model_count; i++) {
212 _modelNames.insert(model_names[i]);
218 _onClose =
reinterpret_cast<decltype(_onClose)
> (
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_ONCLOSE,
false));
223 _setThreadPoolDisabled =
reinterpret_cast<decltype(_setThreadPoolDisabled)
> (
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_SETTHREADPOOLDISABLED,
false));
224 _isThreadPoolDisabled =
reinterpret_cast<decltype(_isThreadPoolDisabled)
> (
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_ISTHREADPOOLDISABLED,
false));
225 _setThreads =
reinterpret_cast<decltype(_setThreads)
> (
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_SETTHREADS,
false));
226 _getThreads =
reinterpret_cast<decltype(_getThreads)
> (
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_GETTHREADS,
false));
227 _setSchedulerStrategy =
reinterpret_cast<decltype(_setSchedulerStrategy)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_SETTHREADSCHEDULERSTRAT,
false));
228 _getSchedulerStrategy =
reinterpret_cast<decltype(_getSchedulerStrategy)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_GETTHREADSCHEDULERSTRAT,
false));
229 _setThreadPoolVerbose =
reinterpret_cast<decltype(_setThreadPoolVerbose)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_SETTHREADPOOLVERBOSE,
false));
230 _isThreadPoolVerbose =
reinterpret_cast<decltype(_isThreadPoolVerbose)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_ISTHREADPOOLVERBOSE,
false));
231 _setThreadPoolGuidedMaxWork =
reinterpret_cast<decltype(_setThreadPoolGuidedMaxWork)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_SETTHREADPOOLGUIDEDMAXGROUPWORK,
false));
232 _getThreadPoolGuidedMaxWork =
reinterpret_cast<decltype(_getThreadPoolGuidedMaxWork)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_GETTHREADPOOLGUIDEDMAXGROUPWORK,
false));
233 _setThreadPoolNumberOfTimeMeas =
reinterpret_cast<decltype(_setThreadPoolNumberOfTimeMeas)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_SETTHREADPOOLNUMBEROFTIMEMEAS,
false));
234 _getThreadPoolNumberOfTimeMeas =
reinterpret_cast<decltype(_getThreadPoolNumberOfTimeMeas)
> (this->
loadFunction(ModelLibraryCSourceGen<Base>::FUNCTION_GETTHREADPOOLNUMBEROFTIMEMEAS,
false));
236 if(_setThreads !=
nullptr) {
237 (*_setThreads)(std::thread::hardware_concurrency());