comp.lang.ada
 help / color / mirror / Atom feed
* Help needed: Access type to functions in generic package
@ 1999-09-12  0:00 Zeiram
  1999-09-12  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 6+ messages in thread
From: Zeiram @ 1999-09-12  0:00 UTC (permalink / 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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-09-13  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-12  0:00 Help needed: Access type to functions in generic package Zeiram
1999-09-12  0:00 ` 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

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