[Pyrex] decoding returned variables

Phil.Cummins at ga.gov.au Phil.Cummins at ga.gov.au
Fri Dec 22 07:49:26 UTC 2006


Hello,

 

I would like to wruite a Pyrex wrapper for a function which is called in C as
follows:

 

     int dbgetv(Dbptr db, char *table_name, char *field_name, void *value1, [
char *field_name2, void *value2, ... ], 0 )

 

I.e., after the first two arguments, the function uses vararg to accept a
variable argument list, which consists of pairs of arguments. Each pair
begins with a character string which specifies which data is to be returned,
followed by a pointer which is the place to put the data. The data returned
could be a character string, an integer, or a double. An example of a call to
dbgetv is:

 

            char rsta[32];

            double rtime, rendtime ; 

            dbgetv ( db, 0, "sta", rsta, "time", &rtime, "endtime",
&rendtime, 0) ;

 

My problem is, how do I tell pyrex what pointers to pass, when their types
are only known at run time? Is there any way to do this without figuring out
what all the possible data types corresponding to the various field names
are? 

 

Thanks,

 

- Phil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20061222/e6ea0743/attachment.html 


More information about the Pyrex mailing list