You get the benefits of an established language to expand the functionality of your application in a flexible way without users having to rebuild the application to use it. In this tutorial, you’ll learn a process for embedding a scripting language into an application. You’ll see how to build the application and how to provide wrapper functions that support full argument and return value support.
IBM is lame….
try bugmenot..
http://www.bugmenot.com/view.php?url=https%3A%2F%2Fwww1…
I have a program I wrote that heavily uses an embedded Perl interpreter, and this article does a good job of the basics. They take you through stack manipulation of calling a Perl function in C, which is nice.
However, one glaring mistake is allowing the Perl code to call C functions (declaring XSUBs). I’m sure it depends on what you ‘re using the interpreter for, but my app is using it to allow the end-user to customize the app beyond what I’ve intended (much like irssi’s Perl scripting does).
So in my app, if someone wants to pop a message box or write to the output window in their additional Perl script, they don’t have a way to do it without being able to call “MyProgramsMessageBox” sub or the like. This is actually a relatively simple thing to do (adding a few xsub declares in the xs_init function they already discussed in the article). I guess I’m just surprised they left it out. I bet that anyone utilizing this article is going to hit that wall pretty quick, and end up just reading perlxs to get the same info. [shrug]
oops, didn’t mean to be Anonymous…
If programming with GNU GCC, GNU Guile http://www.gnu.org/software/guile/ is a Lisp scripting language designed to easily integrate with C.