Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: linking .a when dynamically linking sfml  (Read 2219 times)

0 Members and 1 Guest are viewing this topic.

karanchaudhary009

  • Newbie
  • *
  • Posts: 1
    • View Profile
linking .a when dynamically linking sfml
« on: December 22, 2013, 10:32:07 am »
I wanted to know why do we need to link to *.a library in code::blocks (with mingw) when i copied the .dlls and want to link sfml dynamically.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: linking .a when dynamically linking sfml
« Reply #1 on: December 22, 2013, 12:04:43 pm »
Because Windows is silly and requires what's called an import library to link with the dll's. Import libraries contain a list of all symbols found in a particular dll since you don't link to dll's directly on Windows like you would link to shared libraries on Linux. They have the same extension as static libraries(.a for gcc and .lib for VC++) for what ever reason.

Edit:
SFML marks all static libraries with the -s suffix, which helps to prevent one from confusing an import library with a static library on Windows.
« Last Edit: December 22, 2013, 12:06:34 pm by Jebbs »
DSFML - SFML for the D Programming Language.

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: linking .a when dynamically linking sfml
« Reply #2 on: December 22, 2013, 12:12:45 pm »
You may be able to get away without the implib (though it could be some recent change would prevent it as they dont update that website often):
http://www.mingw.org/wiki/sampleDLL
Quote
Note:

The import library created by the "--out-implib" linker option is required iff (==if and only if) the DLL shall be interfaced from some C/C++ compiler other than the MinGW toolchain. The MinGW toolchain is perfectly happy to directly link against the created DLL. More details can be found in the ld.exe info files that are part of the binutils package (which is a part of the toolchain).