SWIG/Examples/python/pointer/

Simple Pointer Handling

$Header: /cvsroot/swig/SWIG/Examples/python/pointer/index.html,v 1.1 2000/09/02 19:26:03 beazley Exp $

This example illustrates a couple of techniques for handling simple pointers in SWIG. The prototypical example is a C function that operates on pointers such as this:

void add(int *x, int *y, int *r) { 
    *r = *x + *y;
}
By default, SWIG wraps this function exactly as specified and creates an interface that expects pointer objects for arguments. The only problem is how does one go about creating these objects from a script?

Possible Solutions

Example

The following example illustrates the use of these features for pointer extraction.

Notes