XS hacking

[email protected] ("Andreas Lund")
Newsgroups perl.sdl.devel
Message-ID [email protected]
After some stupid problems like editing one copy of SDL-perl and compiling
another I have gotten as far as having perl recognize the existence of a
glGetString() function. Huzzah!

Unfortunately, it doesn't yet DWIM.


// In OpenGL.xs:
char *
glGetString( GLenum name )

This returns undef for every 'name' like GL_RENDERER, GL_VENDOR and
GL_VERSION


// In OpenGL.xs:
char *
glGetString( name )
  GLenum name
  CODE:
    glGetString(name);

This returns a stringified value of 'name'; for GL_RENDERER, GL_VENDOR and
GL_VERSION I get 7937, 7936 and 7938 respectively.


XS has always been a mystery to me, can any of you shed some light on how to
accomplish the exotic idea of getting a \0 terminated string from C please? 

Now, I know this list is not really meant for helping perl newbies but asking
this kind of question outside the scope of SDL-perl tends to spawn all sorts
of alternate suggestions like 'use h2xs', 'use Inline::C' etc. People also
tend to point out the fact that glGetString returns GLubyte* and not char* but
I believe those are compatible?

--
Andreas Lund ([email protected])
Tel: +47 90077162
#include <disclaimer.h>
"Look at you hacker, panting and sweating as you run through my corridors.
How can you challenge a perfect immortal machine?" -- SHODAN, System Shock
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.