newref
newref |
Purpose
Synopsis
void *newref(XPRMcontext ctx,int type, void *ref);
Arguments
ctx
|
Mosel's execution context
|
type
|
Type or structure of the object
|
ref
|
Reference of the object or
NULL
|
Return value
The reference to an object (
i.e. the third argument or a new instance) or
NULL in case of error.
Further information
1. If a native function needs to use the reference to an object after its termination, it must tell the system that the corresponding object must be preserved even if it is no longer used in the model: this is the role of this function. When the reference becomes useless for the native code, it must be released by a call to
delref. The parameter
type can be
XPRM_TYP_MPVAR,
XPRM_TYP_LINCTR,
XPRM_STR_ARR,
XPRM_STR_LIST,
XPRM_STR_SET or the type code of an external type.
2. If the third argument is
NULL, this function returns the reference to a newly created object. However this function cannot be used to create a constant reference, use
newcsr for this purpose.
Related topics