Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall U_GETCHN(allocated_channel, [D_GLOBAL][, requested_channel])
Returned with the allocated channel. (n)
(optional) Allocate channel as global. (n)
(optional) The channel number requested. (n)
U_GETCHN obtains a channel for your own use.
If D_GLOBAL is present, the channel is allocated as global rather than local (meaning that it has to be explicitly purged rather than being purged implicitly upon exit from the current environment). U_FINISH will purge the global channels.
If you do not specify requested_channel, the channel returned in allocated_channel is the first channel available. Allocated_channel is returned as 0 if requested_channel is not available for usage. If requested_channel is specified and available, it is used.
You can use this subroutine in conjunction with specifying U_OPEN’s D_NOALLOC flag. Its primary use is in converting existing applications. If you allocate channels ahead of time and make them global, your existing logic will work.
We recommend that you use U_GETCHN only when converting your applications to use UI Toolkit. Channel allocation is best handled by UI Toolkit’s U_OPEN subroutine and this subroutine can help you coincide your application’s current channel usage with U_OPEN’s future channel allocation. During conversion, you can request a certain channel number (with requested_channel) and then have U_OPEN use that channel rather than allocating a new one.
After conversion, we recommend that you don’t use U_GETCHN to explicitly allocate channels. Allowing U_OPEN to maintain channel usage will help you keep your application modular.
U_RLSCHN routine for information about releasing channels allocated with U_GETCHN
The following example allocates channel 15 and logs it as a global channel.
xcall u_getchn(chn, D_GLOBAL, 15)
The second example gets the first available channel as a local channel.