Many applications, including most of those shipped with Windows, Linux, KDE, Gnome, and Apache are written in C. C is perhaps the most universal of all programming languages — its expressive power, portability, minimalism, and speed make it a popular choice.
Many applications, including most of those shipped with Windows, Linux, KDE, Gnome, and Apache are written in C. C is perhaps the most universal of all programming languages — its expressive power, portability, minimalism, and speed make it a popular choice.
There are, of course, other programming languages, each with its own unique advantages. Indeed, programmers often choose a particular language based on the characteristics and challenges of the task at hand. For example, Perl is invaluable for text processing; PHP makes quick work of web site development; and Python provides for rapid, object-oriented development.
Ideally, all programming languages would “link” somehow, so you could combine and re-use libraries and source code from any one of them in a single executable. (That’s the premise of Microsoft’s .NET and the model for Perl’s new Parrot engine.)
But, alas. If you’re coding in C, you can’t mix and match. Or can you? As it turns out, many scripting languages, including PHP, Perl, and Python, can all be extended with C. And, in the cases of Perl and Python, you can reciprocally extend your C code by embedding interpreters that run scripts.
In fact, Python was explicitly crafted to be both embeddable and extensible: you can integrate the Python interpreter into your C application; you can share data and objects between your C and Python code; and you can even create user interfaces for your software written entirely in Python.
Embedded Python provides a powerful…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: