calling Python from C: I can't get this part.

Carey Evans c.evans at clear.net.nz
Sat Dec 11 15:09:20 EST 1999


Very Frustrated <rwadkins at flash.net> writes:

[...]

> Now, all I want to do is, instead of pointing to a C function that has to
> be compiled and included in the library, I want to have ga_info->EV_fun
> point to a Python function and have the Python function receive the
> (Chrom_Ptr chrom) argument.
> 
> The rest is easy, but even after looking at the examples in the SWIG
> manual, I am still not clear how you do this.

I don't use SWIG myelf, but this looks like the examples in
examples/python/callback and callback2 in my installation.  It might
be a bit harder since you don't get to specify any data to the
callback, so you'd have no way of knowing which instance of GA_config
is being used, unless the Chrom_Ptr includes enough info.

Have you looked at these examples and gotten completely mystified, or
are you having trouble with another bit of this?

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	       "This is where your sanity gives in..."



More information about the Python-list mailing list