From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e314bcfae26d60a X-Google-Attributes: gid103376,public From: John Howard Subject: Re: gnat and dlls Date: 1996/05/20 Message-ID: #1/1 X-Deja-AN: 155733350 references: <4no2nu$60g@cville-srv.wam.umd.edu> content-type: TEXT/PLAIN; charset=US-ASCII organization: SkyNET Corporation mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-05-20T00:00:00+00:00 List-Id: 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 -- 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. -- ------------------------------------------------------------------------