views:

98

answers:

4
+1  Q: 

Library files in C

Are library files .o or .exe files in C?

+3  A: 

Neither. It also depends on the platform. Also, the file extension is only convention and libraries can have any other or no extension at all.

zvrba
+5  A: 

It's more operating system dependent than language dependent.

  • In Windows, they are likely to be .dll files.
  • In Linux, they are likely to be .a or .so files.
  • In OS X, they are likely to be .a, .so or .dylib files.
sharth
+11  A: 

Neither; generally .o files are object files and .exe files are fully-linked binaries (on Windows).

  • Static libraries in Linux are .a
  • Dynamic libraries in Linux are .so
  • Static libraries in Windows are .lib
  • Dynamic libraries in Windows are .dll
Michael Mrozek
there's also .la files which are typically used by libtool
bluesmoon
Theres also the .lib libraries that come with a .dll that you use at compile-time but not runtime. I don't think that are technically static libraries - If I recall, they contain the positions of code in the DLL.
mathepic
+1  A: 

The answer is libraries are neither *.o or *.exe. Also the naming convention depends on the Platform you are compiling. A *.so file is a shared lib. *.a is a static library on the Linux platform.

You can specify options at compile time to build the libraries.

Here you can check more about shared libraries and compilation and build options for the same.

Praveen S