Vely logo Empower C
install     tutorials     examples     documentation     license     about

11.0.11 released on Jul 25, 2022

Startup handler



PURPOSE:


Execute your code once before any request handlers do.

SYNTAX:


void _startup ( ) ...


DESCRIPTION:


To specify your code to execute once before any requests are handled, create a source file "_startup.v" and implement a function "void _startup()", which will be automatically picked up and compiled with your application.

Startup handler will execute just before the first request - meaning when you run an application, it will not execute when it starts, but when it receives the very first request.

If you use any cross-request (global) variables (that would be available to any request served by this process), do not use result(s) of any Vely statements, because such memory is released at the end of each request, and thus would become invalid after the very first request served by this process. If you need to have global data for the duration of the process, use either global variables or use C's "malloc()" functions - they could be defined for example in _startup.v and referenced elsewhere via C's "extern".

EXAMPLES:


Here is a simple implementation of startup handler that just outputs "Hi there!!":
#include <vely.h>

void _startup()
{
    out-header default
    @Hi there!!
}


SEE ALSO:


Requests ( non_request   after_request_handler   before_request_handler   input-param   request   startup_handler   url-param   vely_dispatch_request  )  SEE ALL (documentation)



Copyright (c) 2022 DaSoftver LLC. Vely is a trademark of Dasoftver LLC. The software and information herein are provided "AS IS" and without any warranties or guarantees of any kind. This web page is licensed under CC-BY-SA-4.0.