comp.lang.ada
 help / color / mirror / Atom feed
From: Zeiram <zeiram@deathsdoor.com>
Subject: Help needed: Access type to functions in generic package
Date: 1999/09/12
Date: 1999-09-12T13:20:03+00:00	[thread overview]
Message-ID: <37DBA86F.3805AA69@deathsdoor.com> (raw)

Hello

I'm trying to use access types to functions in a generic package and
GNAT refuses to compile my package. Here's the complete description of
my
problem.

I'm trying to use OpenGL and the GLUT toolkit to display a 3D maze on
the screen. My approach was to create a package specifying a type
T_Maze,
which is generic on the length, height and depth of the maze.

Then, I wanted to create a child of this package for the procedure
displaying
my maze. I have to use access types on functions for defining my
callback functions
used for OpenGL. And, of course, my child package is also generic. My
callback
functions are defined in a child of the child package.

But when I try to compile this with GNAT for Win32, I get the following
error
message:
    access type must not be outside generic body

I tried to move all my callback functions in the body of my display
package, but
the same error message was there. Does anyone have an idea how I could
compile this package?

Here are part of the specs and bodies of my packages.

generic
    Dim_X, Dim_Y, Dim_Z : Positive;
package Maze is
    type T_Cell is (Wall, Corridor, Pebble);
    type T_Maze is array(1..Dim_X, 1..Dim_Y, 1..Dim_Z) of T_Cell;
end Maze;

generic
package Maze.Display is
    procedure Display_Maze(Maze : in T_Maze);
end Maze.Display;

with glut;
with Win32.GL;
with Maze.Display.Callback;
package body Maze.Display is
    package Callback is new Maze.Display.Callback;
    use Callback;

    procedure Display_Maze(Maze : in T_Maze) is
      Menu : Integer;
    begin
      Menu := glutCreateMenu(Main_Menu'access);
    end Display_Maze;

end Maze.Display;

package Maze.Display.Callback is
    procedure Main_Menu(Value : Integer);
end Maze.Display.Callback;

Thanks in advance for helping me.

Regards

    Zeiram





             reply	other threads:[~1999-09-12  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-12  0:00 Zeiram [this message]
1999-09-12  0:00 ` Help needed: Access type to functions in generic package Matthew Heaney
1999-09-12  0:00   ` Zeiram
1999-09-12  0:00     ` Matthew Heaney
1999-09-13  0:00       ` zeiram
1999-09-13  0:00         ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox