Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Inline::C *back* into Perl

by flyingmoose (Priest)
on Feb 14, 2004 at 02:43 UTC ( #328920=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://328920]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-05-22 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?