Menu

How to correct build .a from .dll for 64bit

Help
2020-03-25
2020-05-25
  • Maciej Madajczyk

    Hi
    I try to build libSDL2.a library from SDL2.dll. I create def file (def file is correct) from dll and then .a file:
    dlltool -d SDL2.def -l libSDL2.a
    Copy libSDL2.a to lib directory.
    So far so good.
    But when I try to build the simplest program :
    ...
    int main(){
    SDL_Init(SDL_INIT_VIDEO);
    return 0;
    }

    with :
    gcc -lSDL2 a.c -o a.exe

    I got linker error:
    undefined reference to 'SDL_Init'.

    I know what this means and indeed, in the file libSDL2.a I have got function '__imp_SDL_Init' not 'SDL_init'. Somebody knows why ?

     
  • oset jan

    oset jan - 2020-05-24

    I know it was asked long time ago but I will elaborate on it... As far as I'm concerned there is no (this easy) way to convert dynamic/shared library into static. Why won't you get a ready static one or build it yourself from source?

     
    • Kai Tietz

      Kai Tietz - 2020-05-25

      Hello,

      if you want to "convert" a DLL to a static library, there is no easy
      way but to build it from source. But if you mean to get an import
      library for an existing DLL, that can be achieved without too much
      trouble.
      For the later, use the tool "gendef" to create an ".def" file. See
      for further details documentation about this tool. You can find it in
      our repository, or provided by good distributors.

      Hope this helps
      Kai

      Am So., 24. Mai 2020 um 06:15 Uhr schrieb oset jan
      osetnik@users.sourceforge.net:

      I know it was asked long time ago but I will elaborate on it... As far as I'm concerned there is no (this easy) way to convert dynamic/shared library into static. Why won't you get a ready static one or build it yourself from source?


      How to correct build .a from .dll for 64bit


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/mingw-w64/discussion/723798/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.