Hello,

I'm in the process of writing a small introductory guide to writing
modules for Apache and I really wanted for my readers to be able to test
out some code to get familiar with the table/array api in small programs
before moving on to putting it in a module of their own.

So after messing around with this for a few days and not getting
anywhere at all I'm asking you guys, wheter it's possible to compile a
small program that only uses the pool and table api, basically something
like this (for the 1.3 guide):

/* start example */
int main()
{
        struct pool *my_pool;
        table *my_table;

        (pool *)my_pool = ap_init_alloc();
        (table *)my_table = ap_make_table(my_pool, 0);

        ap_table_setn(my_table, "key", "value");

        ap_table_do(my_callback, NULL, my_table, NULL);

        ap_destroy_pool(my_pool);       
}

int my_callback(void *unused, const char *key, const char *val)
{
        printf("%s => %s\n", key, val);
}
/* end example */

I haven't been successful in getting anything close to this running, any
pointers?

I realize that I can just make a small example for them and just show
the output of what would happen if they ran it, but I think writing a
stand-alone program of their own would benefit in their understanding
of how it works.

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer> 

Reply via email to