Wrapping C API

Ulrich Eckhardt eckhardt at satorlaser.com
Mon Aug 4 09:20:44 EDT 2008


Anish Chapagain wrote:
> I'm new to python and have a task for Wrapping up an old program
> written in C(20.c files), to provide GUI and chart,graph feature in
> Python. I've tried using SWIG but am not getting well in windows
> system, wish to receive guidelines for initiating the task...

Two ways come to mind:
1. ctypes
2. popen

The former is basically an interface to the C language types which makes it
rather easy to load C DLLs and call functions therein. The latter is a way
to start a program with redirected input and output, something that can be
used to remote-control any commandline application.

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list