MFP language @compulsory_link annotation:
When creating an APK package, Scientific Calculator Plus does not copy all user defined .mfps files. Instead, it extracts related .mfps files which includes all referred functions and classes. In some situations, e.g. calling integrate or plot_exprs function, parameter is a string or string based variable so that Scientific Calculator Plus is not able to identify which function will be called in the run at compiling time. Also, if function parameter is an object, its class type is usually unknown before running. User, therefore, needs to add an annotation, @complusory_link, before the calling statement explicitly telling Scientific Calculator Plus what functions and classes should be linked into package. For instance
...
@compulsory_link get_functions("::abc::myf_expr1", "myf_expr2(2)")
integrated_result = integrate(expression_str, variable_str)
@compulsory_link get_classes("::def::hij::my_class1", "::my_class2", "my_class3")
...
In this example, ::abc::myf_expr1 and myf_expr2 are user-defined functions which may be called by function integrate to be integrated. All the functions with name ::abc::myf_expr1 will be compiled into APK package, no matter how many parameters they have. However, only function whose name is myf_expr2 and who is located in a used citingspace and who has exactly 2 parameters or has optional parameter(s) are compiled into APK package.
Similiarly, get_classes links user defined classes ::def::hij::my_class1, ::my_class2 and my_class3. Note that my_class3 doesn't include a full citingspace. compulsory_link statement therefore will search citingspace stack and link in the first matched class (if there is).
If user wants to include all user defined functions and classes, please use annotation statement
@compulsory_link get_all_referred_units()
. Scientific Calculator Plus will link-in all the functions and classes defined by user. But this takes much longer time and the compilation process may throw an error if a class or function is referred but not defined.
Note that get_functions, get_classes and get_all_referred_units are actually MFP functions. However, they are placed under the mfp_compiler citingspace and are only used when packaging APK files.
Also note that the @compulsory_link annotation should be located inside the body of the called function. If it is above function statement or below endf statement, it will not take any effect.