Initializing help system before first use

# unionwrap

Purpose
Set the value of a union as a reference to an entity.
Synopsis
`XPRMunion unionwrap(XPRMcontext ctx, XPRMunion un, int type, void *value);`
Arguments

ctx | Mosel's execution context
un | Reference to a union entity
type | ID of the type of the value to wrap
value | Pointer to an area where the value is stored

Return value
Parameter un or NULL in case of error.
Further information
1. This routine has a similar effect as setunvalue except that when the provided value is not a constant of a basic type, it stores in the union a reference to this value instead of duplicating it.
2. A union can store a reference to a basic type ( e.g. XPRM_STR_REF|XPRM_TYP_INT) but since basic types have no reference counting such a reference must be valid for the duration of the execution of the model.
3. If the provided value is also a union the wrapping operation is executed on the value stored in this union, the operation will fail if its type is not compatible with the destinaton union. The operation will also fail if this value is an undefined union.
Related topics
setunvalue, getunvalue.
Parent Topic Union access

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.