Re: XS hacking

[email protected] (Kartik Thakore)
Newsgroups perl.sdl.devel
Message-ID <[email protected]>
Hi,Andreas are thous types in you type map. If they are what are they typed
as?

Also:
char *
glGetString( name )
 GLenum name
 CODE:
   glGetString(name);

should be

char *
glGetString( name )
 GLenum name
 CODE:
  RETVAL= glGetString(name);
OUTPUT:
   RETVAL


This is because your function is 'expecting' (it easier to explain it this
way) a char*.
On Fri, Sep 4, 2009 at 12:58 AM, Andreas Lund <[email protected]> wrote:

>
> 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.