|See Also:||linkdll , matrix|
This statement should appear at the beginning of the file that your C++ function is defined in. It defines the necessary types and macros for the C++ side of the link.
# include "dll.h"
)This macro creates the prototype for a function that is called name in O-Matrix. It includes the linking convention for the function's parameters
errorwhich are described below.
This is an integer that specifies the number of arguments that are present in the O-Matrix call to name. In the syntax
the arguments are
f(a, b, c, ... )
a, b, c, ...in that order. If this syntax is used, the corresponding value of nret is one.
This is an integer that specifies the number of return values that are present in the O-Matrix call to name. In the syntax
the return values are
[A, B, C, ... ] = f(a, b, c, ... )
A, B, C, ...in that order.
This points to the matrix that contains the first return value for the function call. The matrix
+ 1)contains the second return value and so on. See the matrix section for the meaning of each of the fields of a matrix. The first return value is initialized as follows:
If you do not modify this matrix, the return value of name in O-Matrix will have type
ret->nr = 1
ret->nc = 1
ret->br = 1
ret->nc = 1
ret->name = EMPTY_STRING
ret->type = UNDEF_mat
"novalue". The other return values are initialized in a similar fashion.
This points to the matrix that is the first argument in the O-Matrix function call to name. The value
+ i - 1)points to the i-th argument for
i = 1, ... , narg.
If a simple variable appears as an argument, such as
ain the call
The corresponding value of
f(a, b + 1, c.row(1))
CONSTANT_mat. In this case the matrix points to another matrix that actually contains the information that the original matrix refers to. The function call
)returns a pointer to the matrix that contains the information that the matrix pointer arg refers to. In the example function call above, if you modify the matrix pointed to by
)you will change the value of
ain the calling routine. You must not do this if
If you are returning a matrix that contains elements, you must allocate the memory for those elements using this routine because O-Matrix will free this memory when it is done with it. The function call
)sets the value of the field
->adrto sufficient memory for all the elements in matrix pointed to by mat. This depends on the number of rows, mat
->nr, the number of columns, mat
->nc, and the type of the matrix, mat
allocateis called. If the mat
->adrfield points to allocated memory, it should be freed using
free_matbefore a call to
allocate. (Note that the call
)changes the value of mat
The function call
)frees the memory currently allocated for the elements in the matrix pointed to by mat. It also changes mat
UNDEF_mat. If a matrix has type
CONSTANT_mat, there is no memory allocated for its elements and this call is not necessary.
This function should be used to report errors that are detected while executing the function name. The function call
)will post the O-Matrix execution error dialog with the specified message where help and message are
'\0'terminated character vectors. Warning: this function call will not return and execution of your dll subroutine is immediately be aborted. Thus you should free any locally allocated memory before calling
error. If the user chooses the
Helpbutton in the dialog, the file
.htmis displayed in the users default web browser (where help has been replaced by its value). These errors are like any other O-Matrix error and can be trapped .
This function can be used to output text to the O-Matrix command window.
)will output the string message to the O-Matrix command window.