Recent

Author Topic: Problem with SDL2 under Windows...  (Read 2029 times)

napard

  • New member
  • *
  • Posts: 5
Problem with SDL2 under Windows...
« on: April 04, 2018, 10:10:54 pm »
Hi to all Lazarus/FPC community,

I'm trying to implement a ultra minimal OpenGL engine with Lazarus/FPC, It must be at least usable under Linux and Windows.
Now, if I not misunderstand FPC on windows, it is compatible with binaries and libraries generated by MinGW toolchain, I'm using MinGW64 right now, so in theory I could link with the SDL2 version that gets installed from MinGW. When using the SDL2 pascal headers from https://github.com/ev1313/Pascal-SDL-2-Headers, I get a lot of errors about multiple definitions of same symbols as follow:


Compile package FCL 1.0.1: Success
Compile package dglopengl_package 0.0: Success, Hints: 7
dglOpenGL.pas(15147,13) Hint: Conversion between ordinals and pointers is not portable
dglOpenGL.pas(15170,27) Hint: Conversion between ordinals and pointers is not portable
dglOpenGL.pas(15194,30) Hint: Conversion between ordinals and pointers is not portable
dglOpenGL.pas(19686,63) Hint: Local variable "MinorVersion" does not seem to be initialized
dglOpenGL.pas(19686,49) Hint: Local variable "MajorVersion" does not seem to be initialized
dglOpenGL.pas(20472,24) Hint: Local variable "PFDescriptor" does not seem to be initialized
dglOpenGL.pas(20570,24) Hint: Local variable "PFDescriptor" does not seem to be initialized
Compile package sdl2_package 0.0: Success
Compile package sdl2gpu_package 0.0: Success
Compile package deimos_f_core_package 0.0: Success, Warnings: 22, Hints: 3
config.inc(59,2) Warning: Comment level 2 found
config.inc(60,3) Warning: Comment level 2 found
config.inc(61,1) Warning: Comment level 2 found
config.inc(62,3) Warning: Comment level 2 found
config.inc(63,1) Warning: Comment level 2 found
apploop.pas(18,3) Warning: Comment level 2 found
apploop.pas(23,3) Warning: Comment level 2 found
config.inc(59,2) Warning: Comment level 2 found
config.inc(60,3) Warning: Comment level 2 found
config.inc(61,1) Warning: Comment level 2 found
config.inc(62,3) Warning: Comment level 2 found
config.inc(63,1) Warning: Comment level 2 found
runtimestate.pas(22,3) Warning: Comment level 2 found
runtimestate.pas(24,3) Warning: Comment level 2 found
sdlgpurenderer.pas(48,33) Hint: Parameter "X" not used
sdlgpurenderer.pas(48,36) Hint: Parameter "Y" not used
sdlgpurenderer.pas(50,35) Hint: Parameter "ModeOn" not used
apploop.pas(33,5) Warning: Comment level 2 found
apploop.pas(36,5) Warning: Comment level 2 found
apploop.pas(40,5) Warning: Comment level 2 found
apploop.pas(43,5) Warning: Comment level 2 found
apploop.pas(47,5) Warning: Comment level 2 found
apploop.pas(50,5) Warning: Comment level 2 found
apploop.pas(69,3) Warning: Comment level 2 found
apploop.pas(74,3) Warning: Comment level 2 found
Compile Project, Target: deimos_f_core_test.exe: Exit code 1, Errors: 50
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_free_REAL
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_XInputGetCapabilities
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_Appname
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_Instance
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SYS_Joystick
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_XInputSetState
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_HelperWindow
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.GUID_XAxis
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.GUID_YAxis
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.GUID_ZAxis
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.GUID_RxAxis
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.GUID_RyAxis
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.GUID_RzAxis
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.IID_IDirectInput8W
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.CLSID_DirectInput8
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_hapticlist
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.IID_IDirectInputDevice8W
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.IID_IUnknown
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_LoadLibrary
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_GetProcAddress
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_UnloadLibrary
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_CreateContext
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_MakeCurrent
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_SetSwapInterval
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_GetSwapInterval
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_SwapWindow
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.WIN_GL_DeleteContext
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Multiple defined symbol .refptr.SDL_expand_byte
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: __getreent
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: vfprintf
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: memcpy
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: memmove
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: vsnprintf
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: strncpy
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: strcpy
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: strrchr
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: ___chkstk_ms
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: fread
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: fseek
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: malloc
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: free
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: fopen
deimos_f_core_test.lpr(18,1) Error: Undefined symbol: fclose


Could anyone give me a hint on this?
Thanks in advance...

soerensen3

  • Full Member
  • ***
  • Posts: 211
Re: Problem with SDL2 under Windows...
« Reply #1 on: April 04, 2018, 11:12:38 pm »
Do you need to use a custom built sdl2? Because I use the precompiled dll's for windows with the same headers and everything seems to be working fine.
Lazarus 1.9 with FPC 3.0.4
Target: Manjaro Linux 64 Bit (4.9.68-1-MANJARO)

metis

  • Full Member
  • ***
  • Posts: 192
Re: Problem with SDL2 under Windows...
« Reply #2 on: May 30, 2020, 05:16:33 pm »
Same with me:
The 'SDL2.dll' for Windows, downloaded from the SDL-Homepage together with the mentioned FPC-Header work perfectly from WinXP to Win10.
Life could be so easy, if there weren't those f*** Details.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2093
  • Compiler Developer
Re: Problem with SDL2 under Windows...
« Reply #3 on: May 30, 2020, 06:33:01 pm »
Judging from the error messages napard had tried to link the static library instead of the dynamic one. Pre-3.2.0 compilers had the problem that they couldn't handle the COMDAT sections that MinGW generates (the .refptr symbols). FPC 3.2.0 and newer can, so linking against the static library should work there (it was after all in response to a SDL2 related bug report with the same problem ;) ).

 

TinyPortal © 2005-2018