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 ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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?
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 ?
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?
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: