MIL_CONST_TEXT_PTR FunctionName, | //in |
MIL_INT ParameterNum, | //in |
MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr, | //in |
MIL_CONST_TEXT_PTR SlaveFunctionDLLName, | //in |
MIL_CONST_TEXT_PTR SlaveFunctionName, | //in |
MIL_INT SlaveFunctionOpcode, | //in |
MIL_INT64 InitFlag, | //in |
MIL_ID *CBasedContextFuncIdPtr | //out |
This function allows you to allocate a MIL function context for the current user-defined function. Call MfuncAlloc() in the master function of the user-defined function. MfuncAlloc() signals the creation of a user-defined MIL function context, and should be the first MIL function called in the master function. Once the function context is allocated, your function is known as a user-defined MIL function. A user-defined MIL function is considered a standard MIL function, respecting all MIL environment controls, such as tracing and error handling.
When defining the function context, you must specify a unique opcode for the user-defined function. The opcode is used to locate the slave function when an application executes the user-defined function.
MIL user-defined functions can be grouped into user-defined modules or remain ungrouped. To specify whether a user-defined function is grouped or not, and if grouped, assign it to a specific user-defined module, pass an appropriate opcode to the SlaveFunctionOpcode parameter. Specify the opcode as a combination of two values: an offset from 0 to 63 and a label either identifying the module in which to group the function (M_USER_MODULE_n, where n is a number between 1 and 7) or identifying that the function is ungrouped (M_USER_FUNCTION). A user-defined module can have up to 64 functions, and there can be up to 64 ungrouped functions.
Specifies the name of the user-defined function.
For specifying the name of the
user-defined function
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
MIL_TEXT("FunctionName") 1 |
Specifies the name of the user-defined function. (more details...) |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
Specifies the number of parameters passed to the current user-defined function. Note that the number of parameters should not exceed 16.
Specifies the address of the slave function.
The slave function must be declared as follows:
Specifies the identifier of the user-defined MIL function that references this slave function. This is the identifier returned by the MfuncAlloc() function.
If your slave function will be executed by a system with an on-board processor or if the your slave function's code will be compiled into a library file, you can set this parameter to M_NULL.
Specifies the name of the library file which contains the slave function's code. The library file must be visible to the system executing the slave function.
When developing a user-defined MIL function which will be used in a Distributed MIL application, it is recommended that a copy of the library file be placed on all the remote systems in the cluster, in a directory which is part of the system's path environment variable.
If the library file is not located in a directory which is part of the path environment variable, you can alternatively provide the full path to the file.
If your slave function will be executed by a system with an on-board processor or if the your slave function's code will be included in your application, you can set this parameter to M_NULL.
Specifies the name of the slave function to export from the library file.
This parameter must be set if a library file is provided to the SlaveFunctionDLLName parameter.
If your slave function will be executed by a system with an on-board processor or if the your slave function's code will be included in your application, you can set this parameter to M_NULL.
Specifies the opcode to use to locate the slave function when an application executes the user-defined MIL function. The slave function's opcode also serves to identify which user-defined module, if any, the user-defined function belongs to.
To specify a label identifying that the function is ungrouped, or a label identifying the module in which the function is grouped, specify one of the following:
For specifying the label identifying that
the function is grouped or ungrouped
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_USER_FUNCTION + |
Specifies that the user-defined function is an ungrouped user-defined function. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_USER_MODULE_n + |
Specifies the module in which to group the user-defined function, where n is a value between 1 and 7, inclusive. (more details...) |
You must add the following value to the above-mentioned values to specify the offset.
For specifying the offset
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
0 <= Value <= 63 |
Specifies the offset of the user-defined function among the ungrouped functions or among the functions in a specified group. (more details...) |
Specifies more information about the user-defined MIL function.
The values below allow you to set whether the slave function is executed asynchronously or synchronously.
For specifying whether the slave function
is executed asynchronously or synchronously
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies the default value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_ASYNCHRONOUS_FUNCTION + |
Specifies that the user-defined function will not wait for the slave function to finish executing before executing the next function (typically MfuncFree()) in the master function. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SYNCHRONOUS_FUNCTION + |
Specifies that the user-defined function will wait for the slave function to finish executing before executing the next function in the master function. (more details...) |
You must add one of the following values to the above-mentioned values to set whether the slave function can be executed remotely.
For specifying whether the slave function
can be executed remotely
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_LOCAL |
Specifies that the slave function must be executed by the Host processor. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_REMOTE |
Specifies that the slave function will be executed remotely, if possible. (more details...) |
You can add one of the following values to the above-mentioned value to set the type of the user-defined MIL function.
Note that both M_ALLOC and M_FREE imply that the user-defined function is M_SYNCHRONOUS_FUNCTION, and cannot be added to M_ASYNCHRONOUS_FUNCTION.
For setting the type of user-defined MIL
function
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_ALLOC |
Specifies that the user-defined function is an allocation function, used to allocate a user-defined MIL object on a required system. |
||||||||||||||||||||||||||||||||||||||
M_FREE |
Specifies that the user-defined function frees an object allocated using a user-defined MIL allocation function. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib. |
DLL | Requires mil.dll. |