I have these pieces of C-code (NOT C++ !!) I want to call from Python. I found Boost. I have MS Visual Studio 2005 with C++.
is this the idea: I write the following C source file: ============================ #include <iostream> #include <stdafx.h> namespace { // Avoid cluttering the global namespace. int my_int; /* a global integer: or outside namespace ? */ double calc ( double f) { my_int = (int) (f/2); printf( "Half of %f is %d\n", f, my_int ); return f/2; } } #include <boost/python.hpp> using namespace boost::python; BOOST_PYTHON_MODULE( half ) { def("calc", calc ); } ================================ Which I put in a VC project and compile into a .DLL This DLL I put somewhere on my disk, where Python 2.4 can find it. then I write the following Python source: ===================== from half import * calc(34655.0) et voila ? Can I acces my_int too, this way ? -- http://mail.python.org/mailman/listinfo/python-list