Code.ensure_compiled-exclamation-mark
ensure_compiled-exclamation-mark
, go back to Code module for more information.
Specs
Ensures the given module is compiled and loaded.
If the module is already loaded, it works as no-op. If the module was
not compiled yet, ensure_compiled!/1
halts the compilation of the caller
until the module given to ensure_compiled!/1
becomes available or
all files for the current project have been compiled. If compilation
finishes and the module is not available or is in a deadlock, an error
is raised.
Given this function halts compilation, use it carefully. In particular, avoid using it to guess which modules are in the system. Overuse of this function can also lead to deadlocks, where two modules check at the same time if the other is compiled. This returns a specific unavailable error code, where we cannot successfully verify a module is available or not.
See the module documentation for more information on code loading.