 <p>Each G-WAN script is compiled <em>separately</em>. As a result, all your variables are <em>static</em> (local to this module) - you cannot share them without using pointers and atomic operations.</p> <p>In order to ease the use of <em>global</em> variables, G-WAN provides persistent pointers (<code>US_HANDLER_DATA</code>, <code>US_VHOST_DATA</code>, or <code>US_REQUEST_DATA</code>):</p> <pre><code>void *pVhost_persistent_ptr = (void*)get_env(argv, US_VHOST_DATA); if(pVhost_persistent_ptr) printf("%.4s\n", pVhost_persistent_ptr); // get a pointer on a pointer (to CHANGE the pointer value) void **pVhost_persistent_ptr = (void*)get_env(argv, US_VHOST_DATA); if(pVhost_persistent_ptr) *pVhost_persistent_ptr = strdup("persistent data"); </code></pre> <p>Several examples, like <a href="http://gwan.ch/source/persistence.c" rel="nofollow">persistence.c</a> or <a href="http://gwan.ch/source/stream3.c" rel="nofollow">stream3.c</a> illustrate how to proceed with real-life programs.</p>