module: Re-implement using library constructors/destructors (#2018)

By using constructors/destructors we unify the case of static linking with
that of dynamic linking, and we reuse the build flag FEATURE_INIT_FINI. Using
constructors/destructors also allows us to cover the case where library
constructor/destructor functionality is unavailable, because we can expose the
module registration/unregistration functions as global symbols, to be called
explicitly from within the application.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1952

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
This commit is contained in:
Gabriel "_|Nix|_" Schulhof
2017-09-22 13:35:38 +03:00
committed by Zoltan Herczeg
parent 8d916a44f1
commit 81952f3cd0
11 changed files with 172 additions and 124 deletions
+3 -3
View File
@@ -16,9 +16,9 @@
#include "jerryscript.h"
#include "jerryscript-ext/module.h"
#ifdef JERRYX_NATIVE_MODULES_SUPPORTED
#define MODULE_NAME my_broken_module
/*
* A broken module to test that the loader complains about the absence of on_resolve ()
*/
JERRYX_NATIVE_MODULE (my_broken_module, NULL)
#endif /* JERRYX_NATIVE_MODULES_SUPPORTED */
JERRYX_NATIVE_MODULE (MODULE_NAME, NULL)