Ada Foundation Classes

Frequently Asked Questions

Developed by: John Walker, JSW Technology
Distributed by: Aonix

Copyright John Walker & JSW Technology 1997-2001. All Rights Reserved.
The information contained herein is subject to change without notice.

ObjectAda is a trademark of Aonix
Microsoft, Visual C++, Win32 and Windows NT are trademarks of Microsoft, Inc.

Last updated: 4 June 2001

Please send your comments and suggestions to john@jswalker.demon.co.uk.


Contents

Go back to Ada Foundation Classes

Go back to start of JSW Technology Home Page


Exactly what is AFC?

AFC (the Ada Foundation Classes) is a thin Ada binding to the Microsoft Foundation Classes (MFC).

Training and reference material for using MFC in C++ are widely available. The AFC documentation describes the mapping from C++ to Ada.

AFC includes Ada samples which illustrate the use of AFC. The Scribble sample is derived from the Scribble tutorial used by Microsoft to illustrate the development of Windows applications using MFC. Samples derived from the examples in Programming Windows 95 with MFC and Programming Windows with MFC Second Edition by Jeff Prosise and published by Microsoft Press are also included.

Go to start of Ada Foundation Classes FAQ


What parts of MFC are covered? Not covered?

Version 4.1 of the Ada Foundation Classes provides a binding to the following MFC header files:

Eight configurations of the MFC libraries are supported: If you require further coverage please contact john@jswalker.demon.co.uk. and/or adamark@sd.aonix.com

Go to start of Ada Foundation Classes FAQ


What do I do if I need coverage that isn't provided?

We are always interested in your requirements. Please send your comments and suggestions to john@jswalker.demon.co.uk and/or adamark@sd.aonix.com.

Go to start of Ada Foundation Classes FAQ


How should an Ada programmer go about Windows development using AFC?

My preferred approach is to start with a working application, such as the Scribble sample, and proceed by stepwise refinement. Most of the structure, and much of the code, will be common to many applications.

As with development in C++, this will require access to MFC reference material for both the novice and experienced MFC programmer.

Go to start of Ada Foundation Classes FAQ


How would AFC benefit an Ada programmer looking to do Windows development?

The Microsoft Foundation Classes (MFC) provide a comprehensive framework for the development of Windows applications.

The Ada Foundation Classes (AFC) enable the Ada programmer to code a Windows application in Ada by interfacing to the framework provided by MFC. This combines the benefits of coding in Ada with the widely used Microsoft framework for building Windows applications.

The "thin" binding provided by AFC preserves the structure and naming of MFC allowing the use of widely available training and reference material for MFC.

Go to start of Ada Foundation Classes FAQ


What limitations are there in using Ada as an interface to MFC?

A precise answer to this question has proved illusive.

The Ada Foundation Classes Discussion Paper Mapping C++ to Ada is in preparation to address this question and the more general issues of mapping between C++ and Ada.

Go to start of Ada Foundation Classes FAQ


Can I derive Ada classes from MFC?

C++ classes in MFC are not mapped to tagged records in AFC and therefore Ada classes as such cannot be derived from MFC.

However, the AFC documentation and samples illustrated how to create the Ada equivalent of a C++ class derived from an MFC class. The Derive Ada Class Tool (DACTool) is provided to assist with this process. It generates the Ada equivalent of a derived class in C++.

Some of the issues surrounding this subject will be discussed in the Ada Foundation Classes Discussion Paper Mapping C++ to Ada which is currently under construction.

DACTool forms part of the Symbol Table Viewer Tool (STViewer). STViewer is a browser for the symbol tables used to generate AFC. It can be used to inspect the C++ symbols in MFC and their Ada equivalents.

Go to start of Ada Foundation Classes FAQ


Can I make dispatching and nondispatching calls to virtual functions?

Yes. An Ada package, refered to as a class package, is generated for each C++ class.

A class package interfaces to the visible, that is non-private, member functions of the class. A nondispatching function interfaces directly to the C++ member function. A virtual function is implemented in Ada as a dispatching call through the VFT to the proper member function.

For classes with non-pure virtual functions a nondispatching package is also generated. The nondispatching package interfaces to the visible, that is non-private, virtual function members specific to the class thereby providing nondispatching calls to those member functions.

Go to start of Ada Foundation Classes FAQ


How would one develop a GUI application using AFC?

AFC provides a programming interface to the MFC framework and, as such, it is an enabling technology for the development of GUI applications in Ada.

AFC does not include tools to support the development of GUI applications in Ada.

See also:

Go to start of Ada Foundation Classes FAQ


Can I use the Microsoft Resource Editor to create resources for my Ada application?

Yes. You should use the Resource Editor to generate the .res file and resource.h.

The .res file is linked directly into your application.

The #define constants in resource.h should be declared and used in your Ada source code to access the resources.

The samples illustrate the use of resource files.

Go to start of Ada Foundation Classes FAQ