From: John H. Kelm <johnhkelm@us...> - 2005-07-10 21:29:10
Update of /cvsroot/gaim/web/htdocs/summerofcode/john/posts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3420
--- NEW FILE: 2005-07-10.txt ---
More Attempts at Fixing Perl in HEAD
My scripts to convert the header files in src/ into viable XS code is working relatively well. After running the script, the resulting XS code is almost perfect except for any API calls that take in function pointers which is a little screwy when you would be sending it a Perl reference that would be called by a C program--in our case Gaim--which does not work. I have removed all code like this from the Perl API for the time being to try and get more of the XS code done. Of the sixty or so files I needed to wrap with XSUBS, I have about fifteen or twenty remaining. Once all of these are finished up I want to go back and correct some of the more localized problems which will be uncovered during more complete testing. Anything that takes a callback function pointer as an argument is going to need to be fixed using a separate C function that will use <code>call_sv</code> to call a Perl sub.
I have the code done for handling hashes and arrays, so I can go between Perl and C easily with <code>GHashTable</code>'s and <code>GList</code>/<code>GSList</code>. There is a project that wraps all of the glib and GTK libraries, but it just seems to crash my embedded perl interpreter. I have put off converting the GTK parts of Gaim becuase I do not have a good way to deal with creating many of the values that need to be sent to the <code>gaim_gtk_*</code> API calls.
Today I tried a few new things in my battle with the Perl Interpreter and it running under HEAD. I am of the belief the segfault is a result of the <code>boot_Gaim</code> bootstrap not having a valid pointer to the Perl structure that has all the stack information named pTHX which it should be getting when <code>DynaLoader::bootstrap()</code> loads it. Instead of having the Gaim.so module dynamically loaded where the user puts <code>use Gaim;</code> in his script, I linked it statically to the perl.so module. What this theoretically could do is make all the Gaim XSUBs behave like built in functions of Perl. The good news is it did not crash Gaim after I called <code>boot_Gaim</code> when running <code>perl_parse</code>--it crashed elsewhere. Well, I guess I will just keep at that pesky problem.