import updates to library plugin loader from upstream

This commit is contained in:
Axel Kohlmeyer
2023-01-13 05:21:33 -05:00
parent 812363fb99
commit 0fafe34008
3 changed files with 14 additions and 10 deletions

View File

@ -56,7 +56,8 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
#endif
if (handle == NULL) return NULL;
lmp = (liblammpsplugin_t *) malloc(sizeof(liblammpsplugin_t));
lmp = (liblammpsplugin_t *) calloc(1, sizeof(liblammpsplugin_t));
lmp->abiversion = LAMMPSPLUGIN_ABI_VERSION;
lmp->handle = handle;
#ifdef _WIN32
@ -179,15 +180,11 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
ADDSYM(is_running);
ADDSYM(force_timeout);
#ifdef LAMMPS_EXCEPTIONS
lmp->has_exceptions = 1;
ADDSYM(has_error);
ADDSYM(get_last_error_message);
#else
lmp->has_exceptions = 0;
lmp->has_error = NULL;
lmp->get_last_error_message = NULL;
#endif
lmp->has_exceptions = lmp->config_has_exceptions();
if (lmp->has_exceptions) {
ADDSYM(has_error);
ADDSYM(get_last_error_message);
}
return lmp;
}