synchronize API with library.h, zero struct on allocation, determine exception support at runtime.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
ADDSYM(python_api_version);
|
||||
return lmp;
|
||||
|
||||
Reference in New Issue
Block a user