diff options
author | Björn Gustavsson <[email protected]> | 2015-11-30 15:28:37 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-02-20 07:24:37 +0100 |
commit | e1be12434b06fb2594af5cdafc5efc5b9182d8b6 (patch) | |
tree | 76063230a59c5bebbd02aa2be57569b0d03608f2 /erts/emulator/beam/beam_load.c | |
parent | 48411ad12f4d730412895e90c188c2d8f7813ce5 (diff) | |
download | otp-e1be12434b06fb2594af5cdafc5efc5b9182d8b6.tar.gz otp-e1be12434b06fb2594af5cdafc5efc5b9182d8b6.tar.bz2 otp-e1be12434b06fb2594af5cdafc5efc5b9182d8b6.zip |
beam_load.c: Add a function to check for an on_load function
We will need a way to check whether an prepared BEAM modules has
an on_load function.
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r-- | erts/emulator/beam/beam_load.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index 1511a4f935..f115df935f 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -888,6 +888,23 @@ erts_module_for_prepared_code(Binary* magic) } } +/* + * Return a non-zero value if the module has an on_load function, + * or 0 if it does not. + */ + +Eterm +erts_has_code_on_load(Binary* magic) +{ + LoaderState* stp; + + if (ERTS_MAGIC_BIN_DESTRUCTOR(magic) != loader_state_dtor) { + return NIL; + } + stp = ERTS_MAGIC_BIN_DATA(magic); + return stp->on_load ? am_true : am_false; +} + static void free_loader_state(Binary* magic) { |