[C++-sig] pass function pointer to c extension function in python
ngoodspeed at solidworks.com
Wed Oct 4 16:11:32 CEST 2006
From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org] On
Behalf Of Qinfeng(Javen) Shi
Sent: Wednesday, October 04, 2006 5:40 AM
To: c++-sig at python.org
Subject: [C++-sig] pass function pointer to c extension function in
I used a global function pointer op, so that when op = add, it operates
as add, when op = minus, it operates as minus. I used a function
choose_op() to set op = add or minus. It works if I call choose_op()
inside other function exposed in python. It reported a error when I used
bjam to compile it if I exposed it into python.
Any suggestion will be appreciated. Thanks in advance.
[Nat] How were you planning to have the client Python code pass to
choose_op() a parameter of type 'float (* method)(float a, float b)'?
Maybe you could publish to Python a wrapper function that accepts a
string or something. On receiving "+", it would call choose_op(add), and
More information about the Cplusplus-sig