Overview
MUFL uses these keywords to access other applications and libraries from within applications, libraries, and scripts.
Loads
Loading Libraries
MUFL libraries are loaded similarly to how the C++ include
statement works. The MUFL compiler loads the library’s codebase and provides visibility into (non-hidden) data and functions.
To load a library, use the loads <library_name>
syntax. For example:
library C loads library D
{
var = D::var.
D::my_func().
}
library D
{
var = 4.
fn my_func (_)
{
_print "Hello from D\n".
}
}
script A loads library C
{
_print C::var.
}
Prints:
Hello from D
4
Study the code to understand the order of the printed results.
Loading Applications
Applications can be loaded by other code in order to enable initialization of nested packets because nested packets must be initialized with a MUFL application.
Loading applications does not provide access to the application’s data or functions.
For example:
application key_management loads library cryptography application key_set {
// initialize a nested packet using application key_set
}
Uses Transactions
The uses transactions
keyword phrase is the shortcut equivalent of loads libraries transaction, __t_wrapper
to make loading all libraries needed for implementing the packet interface more convenient.
If in the future, additional libraries are required to implement transactions, no source code needs to be changed.