refactor: Clarify initialize globals

master
Sean McBride 4 years ago
parent 8a8f7d995b
commit 1757ac8e51

@ -48,12 +48,12 @@ awsm_abi_init(struct awsm_abi *abi, char *path)
goto dl_error; goto dl_error;
} }
/*
* This symbol may or may not be present depending on whether the aWsm was
* run with the --runtime-globals flag. It is not clear what the proper
* configuration would be for SLEdge, so no validation is performed
*/
abi->initialize_globals = (awsm_abi_init_globals_fn_t)dlsym(abi->handle, AWSM_ABI_INITIALIZE_GLOBALS); abi->initialize_globals = (awsm_abi_init_globals_fn_t)dlsym(abi->handle, AWSM_ABI_INITIALIZE_GLOBALS);
if (abi->initialize_globals == NULL) {
fprintf(stderr, "Failed to resolve symbol %s in %s with error: %s\n", AWSM_ABI_INITIALIZE_GLOBALS, path,
dlerror());
goto dl_error;
}
abi->initialize_memory = (awsm_abi_init_mem_fn_t)dlsym(abi->handle, AWSM_ABI_INITIALIZE_MEMORY); abi->initialize_memory = (awsm_abi_init_mem_fn_t)dlsym(abi->handle, AWSM_ABI_INITIALIZE_MEMORY);
if (abi->initialize_memory == NULL) { if (abi->initialize_memory == NULL) {

@ -76,13 +76,14 @@ module_acquire(struct module *module)
} }
/** /**
* Invoke a module's initialize_globals * Invoke a module's initialize_globals if the symbol was present in the *.so file.
* This is present when aWsm is run with the --runtime-globals flag and absent otherwise.
* @param module * @param module
*/ */
static inline void static inline void
module_initialize_globals(struct module *module) module_initialize_globals(struct module *module)
{ {
module->abi.initialize_globals(); if (module->abi.initialize_globals != NULL) module->abi.initialize_globals();
} }
/** /**

Loading…
Cancel
Save