|Do you know where your variables are?|
Inline::C *back* into Perlby flyingmoose (Priest)
|on Feb 14, 2004 at 00:10 UTC||Need Help??|
flyingmoose has asked for the wisdom of the Perl Monks concerning the following question:
update: somehow I stumbled upon the answer to this. spooky, but I'm still open to suggestions for improvements/further-research.
Original question: I'm writing a toy program using Inline::C (which is awesome, BTW), but I have hit a painful roadblock. I'm calling a C function that will never return, so I need to call Perl code from this C event handler. What is the cleanest way to achieve this? I'm very strong in C, I'm pretty darn good in Perl, but mixing the two is rather new to me. XS, due to similarity to JNI, has scared me until this point, but I am afraid this is where I must go.
Ok, folks, after fighting trying to get OpenGL.pm and SDL's OpenGL tools working on my system (thanks for the help everyone), I've given up on being able to hit 3D graphics from Perl.
My current tactic is to use Inline::C and write simple wrappers to GLUT. Freeglut is actually looking very promising as a library, so there is a lot of merit in trying this.
In a lame attempt to keep my program compiling on most platforms, I'd like to use the stock 1.3 freeglut that comes with Fedora Core 1. That is, a very old version.
As many of you know, glut has a function called "GlutMainLoop" that takes over control of a program and never lets it go. This defeats my goal of being able to script most of my game in Perl with bindings to GLUT.
Bottom line -- is there a method suitable for calling Perl functions from inline C code, or do I need to move to XS? I have been avoiding XS until now due to the annoyances of makefiles and various methods, not being exactly 'fun' for this side project.
Suggestions? For the record, I am enjoying these black arts of llama conjuring, and diving deeper is ok -- I could definitely use some pointers though.