Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6073573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:17:08+00:00 2026-05-23T10:17:08+00:00

I am building a dll from assembly on Windows using the GNU binutils. I

  • 0

I am building a dll from assembly on Windows using the GNU binutils.

I know that the dll can be either loaded when the executable is loaded or at run-time (using the LoadLibrary api call).

For load-time loading, I seem to be only needing the dll file : no .a, .lib or .def file is needed. I wondered what these file format represent and what purpose do they serve.

What I know and some specific questions :

  • .a is the extension generally used for static library on Unix. .a files are generated with the –out-implib option of GNU ld. It is said to be an “import library”, fair enough. The question is then “What good is an import library to me if I don’t need it when linking ?”

  • .lib is the extension used for static library on Windows, and according to wikipedia, is also used as “import library” under windows, so I strongly suspect they’re just another name for what the binutils call .a files. True/false ?

  • All pages I can find points that .def files list the exported symbol of the dll. Isn’t that somewhat similar to what an “import library” is supposed to do ?

  • Also, I read here that using .def files is an alternative to manually specifying exports in the source file (which I did). But I also remember reading (cannot find reference back) .def file supply an index (ordinal) into the exported symbols, allowing for faster run-time loading. Is that so ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:17:09+00:00Added an answer on May 23, 2026 at 10:17 am

    Static libraries on Linux have the .a file extension. Static libraries on Windows have the .lib file extension. Dynamic libraries on Windows have the .dll extension; in order to link against a DLL, an import library is required. The import library is a static library. It contains the code required to load the DLL. Now you’re using GCC (not cl.exe) to compile on Windows. GCC has another file extension convention for import libraries, it “should be called *.dll.a or *.a”, as explained in the doc for the --out-implib you referred to.

    Import libraries (.lib with MSVC or .dll.a with GCC) are static libraries: they contain the code to load the DLL. I had the same question the other day.

    A DLL may have functions that are exported and functions that are not exported. An import library has to know which functions are exported and which aren’t. One of the means of telling it is a DEF file.

    When building the DLL, the linker uses
    the .def file to create an export
    (.exp) file and an import library
    (.lib) file. The linker then uses the
    export file to build the DLL file.
    Executables that implicitly link to
    the DLL link to the import library
    when they are built.
    — MSDN: Exporting from a DLL Using DEF Files

    Also see MSDN: Exporting Functions from a DLL by Ordinal Rather Than by Name, together that should answer your last question on export by index, or ordinal number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a COM object in x86 assembly using NASM. I understand COM
I'm building an app using Windows Azure Table. I've encapsulated all my calls to
I'm building a c++ DLL in visual studio 2008. For some reason, even when
I'm building a project along with a Dll. The Dll must support native code
I am building a C# ActiveX DLL... do I use REGASM or REGSVR32 to
I'm building an NServiceBus service, and when I start it (either in debug through
I am building a Setup Package using VS2008. This is a regular setup package
I am building a class library and using its default namespace as System. There
I'm building a python application from some source code I've found Here I've managed
I’m having some difficulties while trying to consume an unmanaged-code dll from my application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.