Previous: GNAT-Style Import Library, Up: Creating an Import Library


F.8.2.3 Microsoft-Style Import Library

With GNAT you can either use a GNAT-style or Microsoft-style import library. A Microsoft import library is needed only if you plan to make an Ada DLL available to applications developed with Microsoft tools (see Mixed-Language Programming on Windows).

To create a Microsoft-style import library for API.dll you should proceed as follows:

  1. Create the definition file API.def from the DLL. For this use either the dll2def tool as described above or the Microsoft dumpbin tool (see the corresponding Microsoft documentation for further details).
  2. Build the actual import library using Microsoft's lib utility:
              $ lib -machine:IX86 -def:API.def -out:API.lib
         

    If you use the above command the definition file API.def must contain a line giving the name of the DLL:

              LIBRARY      "API"
         

    See the Microsoft documentation for further details about the usage of lib.