comp.lang.ada
 help / color / mirror / Atom feed
From: John Howard <jhoward@sky.net>
Subject: Re: gnat and dlls
Date: 1996/05/20
Date: 1996-05-20T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SOL.3.91.960520023032.22950B@sky.net> (raw)
In-Reply-To: 4no2nu$60g@cville-srv.wam.umd.edu


On 19 May 1996, Eric Anthony Spear wrote:
> Is there any way I can write procedures in Ada, compile with gnat, and
> end up with a dll, which could then be accessed by a windows program,
> like visual basic?

Not by only using the current GNAT system.  However, GNAT can create the 
necessary object code of DLL exported subprograms and objects (variables, 
etc.).  But a DLL is constructed differently than an executable.  And the 
linker process must be informed (traditionally via an "import library") 
of the names and locations of entities that were marked as exported.  
Traditionally, the key component in creating a DLL is the DEF file.  A 
DEF file specifies that you want to create a DLL instead of an 
executable, and defines all the exported entities and how the data 
segments are assigned.

By default, the GNAT system automatically handles the linker process.  
Consequently GNAT makes building a program look a little simpler because 
the compile-and-link steps appear to be integrated.  The traditional 
route is for a programmer to create a Make file to control every detail 
of compiling and linking for a project.  GNAT allows us to use either the 
integrated route or a traditional route.  The glitch is that GNAT 
currently lacks integrated support for DLL construction and "import 
library" linkage.  Therefore take a traditional route for DLL's with 
GNAT.

Dynamic link library facts:
A DLL is not an executable.  A DLL lacks a "main() function" and a 
stack.  A DLL uses the same stack as the application.  The purpose of a 
DLL is to provide code and/or resources that can be used by more than one 
process.  In general, subprograms that could reside in an application can 
be placed into a DLL.

Both 16-bit DLL's and 32-bit DLL's exist.  16-bit DLL's are more 
difficult to handle when the Data Segment does not equal the Stack 
Segment.  For 32-bit DLL's, the Data Segment always equals the Stack 
Segment.  DLL's can work in various operating systems including IBM OS/2, 
MS Windows, and DOS.

------------------------------------------------------------------------
-- John Howard <jhoward@sky.net>                       -- Team Christ --
--   New American Standard Bible  (Psalm 22:30-31)                    --
--     Posterity will serve Him;                                      --
--     It will be told of the Lord to the coming generation.          --
--     They will come and will declare His righteousness              --
--     To a people who will be born, that He has performed it.        --
------------------------------------------------------------------------




  parent reply	other threads:[~1996-05-20  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-19  0:00 gnat and dlls Eric Anthony Spear
1996-05-19  0:00 ` Tom Griest
1996-05-20  0:00   ` Darren C Davenport
1996-05-20  0:00 ` Wiljan Derks
1996-05-22  0:00   ` gnat and dlls: ObjectAda Dave Wood
1996-05-20  0:00 ` John Howard [this message]
1996-05-21  0:00 ` gnat and dlls Doug Warner
replies disabled

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