http://www.perlmonks.org?node_id=328920


in reply to Inline::C *back* into Perl

SUCCESS -- I HAVE STUMBLED ONTO BLACK MAGIC!!! Here's the basics...
use Inline C => DATA => LIBS => "-lblah..."; perl_calling_c(); sub c_calling_perl() { print "transcendance\n"; } __DATA__ void perl_calling_c() { call_pv('c_calling_perl',G_DISCARD|G_NOARGS); }

Believe it or not, this works! Awesome! And I have no idea how this ever worked, or what evils it does, but yeeha, I have solved my problem of OpenGL callbacks.

For those OpenGL folks, consider "perl_calling_c" as a "GlutMainLoop" and "c_calling_perl" as one of the functions such as a registered "glutDisplayFunc", which will later hand back down crossing the boundary one or more times in an attempt to blow everyone's minds away.

It's going to take me a few days before I get "spinning cube" up and running with this wild method, but I will certaintly post the Code when I have it.

So far, it's looking a little slow, with a call down and back up (of trivial nature) taking 0.08 real seconds on my 2.4GHz laptop. Printing directly takes 0.003 -- or roughly 25 times slower. I bet, though, for what I want to do this will be good enough.