next up previous contents
Next: About this document ... Up: 4.4 Using function dispatch Previous: 4.4.2 Searching the function   Contents

4.4.3 Building argument structures and running commands

int im_free_vargv( im_function *fn, 
    im_object *vargv )
int im_allocate_vargv( im_function *fn, 
    im_object *vargv )

These two functions allocate space for and free VIPS argument lists. The allocate function simply calls im_malloc() to allocate any store that the types require (and also initializes it to zero). The free function just calls im_free() for any storage that was allocated.

Note that neither of these functions calls the init, dest or print functions for the types -- that's up to you.

int im_run_command( char *name, 
    int argc, char **argv )

This function does everything. In effect,

im_run_command( "im_invert", 2, 
    { "fred.v", "fred2.v", NULL } )

is exactly equivalent to

system( "vips im_invert fred.v fred2.v" )

but no process is forked.



John Cupitt 2004-11-02