19.0.0 released Nov 08, 2023
Set app

Purpose: Set process data.

set-app process-data <data>

set-app sets information related to an application or a process that runs it. A process may handle one or more requests, hence such data is cross-request and process-wide in scope. Some of this information is used by Vely and some is used by you in your code.

If you wish to set up global-process-data, you can do so by providing <data> in the "process-data" clause, which is a pointer to any type. Internally, this pointer is saved as void*, so it can be cast to anything. <data> can be retrieved later anywhere in any request served by the process with get-app (see "process-data" clause).

Process data has to be unmanaged memory because it is available across requests, see memory-handling.
To set global process data, for instance in _startup.vely (i.e. in startup-handler):
// Define global process memory pointer
my_type *mydata;

// Create global process memory
manage-memory off
new-mem mydata size sizeof(my_type)
manage-memory on

// Set global process memory
set-app process-data mydata

See global-process-data for more details and an example.
See also
Application information
See all

You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a dofollow link back to this page - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind. Icons from table-icons.io copyright PaweĊ‚ Kuna, licensed under MIT license.