Thread overview
Optimisation Bug? - Access Violation - C function pointers
Jun 12, 2004
J Anderson
Jun 13, 2004
Regan Heath
Jun 15, 2004
J Anderson
June 12, 2004
Can D understand C function pointers?

With glee I'm finding that many of the extensions aren't working with optimisation on. I reduced it down to one sample set of functions but there is still a bit of code.  Now the error occurs when optimisation is off as well but only with this reduced version.   The weird thing is that the error doesn't occur until its left the function being called.

The major difference between glee and other lib converts I've seen is that it uses function pointers.  Oh and another thing.  I did find a workaround by wrapping the function pointers in a C function but I would really wish to avoid that.

--Test code

import std.process;
import gleetest;
import net.BurtonRadons.dig.main;
import net.BurtonRadons.dig.gl;

class GLFrame : public CanvasGL
{
    this (Control parent)
    {
        super (parent);
        GLeeInit();
        test(); //Access violation when the function exits
        printf("this will not print\n");
    }

    void test()
    {
        glBeginQueryARB(GL_SAMPLES_PASSED_ARB, 1);
        glEndQueryARB(GL_SAMPLES_PASSED_ARB);
        printf("this will print\n");
    }
}

class Program : public Frame
{
    GLFrame frame;
    this()
    {
        //Register frame
        frame = new GLFrame(this);
    }
}

void main( )
{
    Program prog = new Program();
    prog.showModalGame();

    std.process.system("pause");
}

-- 
-Anderson: http://badmama.com.au/~anderson/



June 13, 2004
It took me till the second paragraph below to realise 'glee' was a lib of some sort, till then I thought you were being sarcastic when you said "With glee I'm finding ..."

:)

On Sun, 13 Jun 2004 06:38:28 +0800, J Anderson <REMOVEanderson@badmama.com.au> wrote:
> Can D understand C function pointers?
>
> With glee I'm finding that many of the extensions aren't working with
> optimisation on. I reduced it down to one sample set of functions but
> there is still a bit of code.  Now the error occurs when optimisation is
> off as well but only with this reduced version.   The weird thing is
> that the error doesn't occur until its left the function being called.
>
> The major difference between glee and other lib converts I've seen is
> that it uses function pointers.  Oh and another thing.  I did find a
> workaround by wrapping the function pointers in a C function but I would
> really wish to avoid that.
>
> --Test code
>
> import std.process;
> import gleetest;
> import net.BurtonRadons.dig.main;
> import net.BurtonRadons.dig.gl;
>
> class GLFrame : public CanvasGL
> {
>     this (Control parent)
>     {
>         super (parent);
>         GLeeInit();
>         test(); //Access violation when the function exits
>         printf("this will not print\n");
>     }
>
>     void test()
>     {
>         glBeginQueryARB(GL_SAMPLES_PASSED_ARB, 1);
>         glEndQueryARB(GL_SAMPLES_PASSED_ARB);
>         printf("this will print\n");
>     }
> }
>
> class Program : public Frame
> {
>     GLFrame frame;
>     this()
>     {
>         //Register frame
>         frame = new GLFrame(this);
>     }
> }
>
> void main( )
> {
>     Program prog = new Program();
>     prog.showModalGame();
>
>     std.process.system("pause");
> }
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
June 15, 2004
Regan Heath wrote:

> It took me till the second paragraph below to realise 'glee' was a lib of some sort, till then I thought you were being sarcastic when you said "With glee I'm finding ..."
>
> :)

lol

-- 
-Anderson: http://badmama.com.au/~anderson/