Extension Modules in C

Michael Saunders michael at amtec.com
Thu Mar 28 11:17:21 EST 2002


I am trying to wrap an existing C API as an extension module for Python. Some of
the functions have parameters that are both input and output. Yea, I know it
stinks. Does Python support this notion of a passed parameter being modified?

For instance if I had a c function:

  int GetSomeInfo(char **Title, int *count, int *size);

where it would be called as follows:

  int isOk, count, size;
  isOk = GetSomeInfo(NULL, &count, &size);

where addresses of the storage locations are passed or NULL if you are not
interested in the information.


Can this function be wrapped to have a similar API from python. For instance in
Pytyon:

    isOk = SomeModule.GetSomeInfo(None, count, size)
    if isOk:
         print count, size
    
Thanks,
Michael




More information about the Python-list mailing list