[mod_python] Executing c++ functions through psp

Graham Dumpleton graham.dumpleton at gmail.com
Thu Apr 17 03:59:36 EDT 2008


2008/4/17  <rahul.warhekar at edisphere.com>:
> hello all
>
>  I want to execute user defined function written in c++ using python server
>  pages.
>  i.e. give input to that function and exccept output from that function and
>  display that output on web page.
>
>  can any one help me with this?

You need to do what you would do if it was normal Python code. You
need to write a Python extension module. You can either do this
explicitly using Python C API:

  http://docs.python.org/ext/ext.html
  http://docs.python.org/api/api.html

or use tools such as SWIG:

  http://www.swig.org

or Python Boost library:

  http://www.boost.org/doc/libs/1_35_0/libs/python/doc/index.html

You also may be able to use ctypes module:

  http://docs.python.org/lib/module-ctypes.html

if you are lucky to map calls direct into DLL/shared library.

Since all this is independent of mod_python, perhaps better to ask
further questions on Python mailing list.

  http://groups.google.com/group/comp.lang.python/topics?lnk=lr

Graham


More information about the Mod_python mailing list