TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Stephen Leake <[log in to unmask]>
Reply To:
Stephen Leake <[log in to unmask]>
Thu, 16 Nov 2000 14:40:08 -0500
text/plain (45 lines)
Stephane Richard <[log in to unmask]> writes:

> Hello everyone,
> I am currently seeking information about developing windows applications
> in ADA.  I know that some bindings exist currently such as Windex, gtkAda and
> the likes. However, if possible, I would rather call API functions directly
> rather than using these libraries.

Just out of curiosity, why?

> Could anyone point me to some good reference on the subject? I know
> about API calls and such things, I would like a good reference on
> using these API calls from ADA. Maybe some sample applications would
> be good reference as well.

Windex is a good example of calling the Windows APIs. It comes with a
couple small example applications.

ObjectAda comes with the Petzold book examples rewritten in Ada; it
uses the Win32Ada bindings. That was the reason I wrote Windex; those
examples are just horrible! type conversions all over the place, in
the top-level user code.

> Adn finally, I would like to add other windows DLLs.
> I'm also familiar with the ADA  Pragma Linker options such has -lwindows,
> -lgdi32, -luser32, I assume -lkernel or -lkernel32  If I add these pragmas I
> assume it would make the functions in these DLLs available to the
> application.  What I need to know is the finishing move, hence calling an actual API
> function in Ada.

You also need the function declarations and pragma Imports. These are
a pain to write; you have to read the Windows API documentation
carefully, and guess at the things they leave out. Such as, is this
routine going to save a copy of this pointer I'm giving it? Whose
going to destroy this construct later? Lots of fun. That's why Windex,
CLAW etc exist; to save you that pain.

I suggest you start by reading the Windex source. If you like what you
see, consider adding to it; there's lots to be done!

-- Stephe