comp.lang.ada
 help / color / mirror / Atom feed
* OpenGl and ADA95 by Aonix
@ 1998-02-13  0:00 Colson Eric
  1998-02-13  0:00 ` Stephen Leake
  1998-02-13  0:00 ` Robert Dewar
  0 siblings, 2 replies; 5+ messages in thread
From: Colson Eric @ 1998-02-13  0:00 UTC (permalink / raw)



Hello,

I would like to interface Glut32.dll and Ada95 (I use the version by Aonix
under Win95) but I've got a problem with the function GlutInit and their
parameters.
I've seen in the package  glut.ads for Gnat that the specification for
GlutInit is:

       procedure glutInit (argcp : access Integer;
                           argv  : access Interfaces.C.Strings.Chars_Ptr);
       pragma Import (C, glutInit, "glutInit", "glutInit");

With Aonix, the problem is the parameters look like not to be recognize. I
obtain at the moment of the execution the following message :
"exception raised : constraint error
exception message : access error"

With the debugger, I've understand that this problem is due toGlutInit?

What can I do?

By advance.

Eric
















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

* Re: OpenGl and ADA95 by Aonix
  1998-02-13  0:00 OpenGl and ADA95 by Aonix Colson Eric
  1998-02-13  0:00 ` Stephen Leake
@ 1998-02-13  0:00 ` Robert Dewar
  1 sibling, 0 replies; 5+ messages in thread
From: Robert Dewar @ 1998-02-13  0:00 UTC (permalink / raw)



<<       pragma Import (C, glutInit, "glutInit", "glutInit");

>>

It is almost always wrong to give both an external name and a link name
for a pragma Import. It is very unusual to ever need to give a link name,
and of course it makes the pragma import highly system dependent (e.g.
running into the issue of whether or not an underscore is prepended).





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

* Re: OpenGl and ADA95 by Aonix
  1998-02-13  0:00 OpenGl and ADA95 by Aonix Colson Eric
@ 1998-02-13  0:00 ` Stephen Leake
  1998-02-16  0:00   ` Ken Thomas
  1998-02-13  0:00 ` Robert Dewar
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Leake @ 1998-02-13  0:00 UTC (permalink / raw)



Colson Eric wrote:
> I've seen in the package  glut.ads for Gnat that the specification for
> GlutInit is:
> 
>        procedure glutInit (argcp : access Integer;
>                            argv  : access Interfaces.C.Strings.Chars_Ptr);
>        pragma Import (C, glutInit, "glutInit", "glutInit");
> 
> With Aonix, the problem is the parameters look like not to be recognize. I
> obtain at the moment of the execution the following message :
> "exception raised : constraint error
> exception message : access error"
> 

This means that you are passing a null pointer. If you post the code
that calls glutInit, maybe we can help more.

-- 
- Stephe




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

* Re: OpenGl and ADA95 by Aonix
  1998-02-13  0:00 ` Stephen Leake
@ 1998-02-16  0:00   ` Ken Thomas
  1998-02-16  0:00     ` Robert Dewar
  0 siblings, 1 reply; 5+ messages in thread
From: Ken Thomas @ 1998-02-16  0:00 UTC (permalink / raw)



Stephen Leake wrote:
> 
> Colson Eric wrote:
> > I've seen in the package  glut.ads for Gnat that the specification for
> > GlutInit is:
> >
> >        procedure glutInit (argcp : access Integer;
> >                            argv  : access Interfaces.C.Strings.Chars_Ptr);
> >        pragma Import (C, glutInit, "glutInit", "glutInit");
> >
> > With Aonix, the problem is the parameters look like not to be recognize. I
> > obtain at the moment of the execution the following message :
> > "exception raised : constraint error
> > exception message : access error"
> >
> 
> This means that you are passing a null pointer. If you post the code
> that calls glutInit, maybe we can help more.
> 
> --
> - Stephe

You might also check that the prototype in C is
    void glutInit(int argcp*, char ***argv)
and not
    int glut(...

Ada cannot ignore the result of a function call as in C.

Ken\x18
-- 
Dr K.S. Thomas
Department of Electronics and Computer Science
University of Southampton
Highfield
Southampton SO17 1BJ
United Kingdom

Telephone : (+44) 01703 592170
Fax :       (+44) 01703 593903

email: kst@ecs.soton.ac.uk




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

* Re: OpenGl and ADA95 by Aonix
  1998-02-16  0:00   ` Ken Thomas
@ 1998-02-16  0:00     ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 1998-02-16  0:00 UTC (permalink / raw)



Ken says

<<Ada cannot ignore the result of a function call as in C.
>>

This is not a feature of C, which requires, except in the case of varagrs, that
the parameters 
match up. Some C compilers may allow this, but it is not part of the language.





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

end of thread, other threads:[~1998-02-16  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-13  0:00 OpenGl and ADA95 by Aonix Colson Eric
1998-02-13  0:00 ` Stephen Leake
1998-02-16  0:00   ` Ken Thomas
1998-02-16  0:00     ` Robert Dewar
1998-02-13  0:00 ` Robert Dewar

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