[Lazarus] SDL2 - win64

Björn Lundin b.f.lundin at gmail.com
Wed Mar 23 19:22:48 CET 2016

Using Lasarus 1.4.4
I'm following the SDL tutorial at
and get problems very fast.

looking at http://www.freepascal-meets-sdl.net/chapter-5-drawing-primitives/
I have the code starting like this

program Chapter5_SDL2;

uses SDL2;

i : integer;
sdlWindow1 : PSDL_Window;
sdlRenderer : PSDL_Renderer;
sdlRect1 : PSDL_Rect;
sdlPoints1 : array[0..499] of PSDL_Point;


  //initilization of video subsystem
  if SDL_Init( SDL_INIT_VIDEO ) < 0 then HALT;

  sdlWindow1 := SDL_CreateWindow( 'Window1', 50, 50, 500, 500,
  if sdlWindow1 = nil then HALT;
  sdlRenderer := SDL_CreateRenderer( sdlWindow1, -1, 0 );
  if sdlRenderer = nil then HALT;
and so on

However it crashes with runtime error 217 on line
sdlRenderer := SDL_CreateRenderer( sdlWindow1, -1, 0 );
I get '1' on the screen but not '2'

Runtime error 217 at $000007FEFD28ADAD

if run from Lazarus, I get  some assembler listing


000007FEFD28AD70 4881ecc8000000           sub    $0xc8,%rsp
000007FEFD28AD77 83e201                   and    $0x1,%edx
000007FEFD28AD7A 488d05efffffff           lea    -0x11(%rip),%rax        #
0x7fefd28ad70 <RaiseException>
000007FEFD28AD81 894c2420                 mov    %ecx,0x20(%rsp)
000007FEFD28AD85 33c9                     xor    %ecx,%ecx
000007FEFD28AD87 4889442430               mov    %rax,0x30(%rsp)
000007FEFD28AD8C 89542424                 mov    %edx,0x24(%rsp)
000007FEFD28AD90 48894c2428               mov    %rcx,0x28(%rsp)
000007FEFD28AD95 4d85c9                   test   %r9,%r9
000007FEFD28AD98 0f859a080100             jne    0x7fefd29b638
000007FEFD28AD9E 894c2438                 mov    %ecx,0x38(%rsp)
000007FEFD28ADA2 488d4c2420               lea    0x20(%rsp),%rcx
000007FEFD28ADA7 ff15f3040400             callq  *0x404f3(%rip)        #
0x7fefd2cb2a0 <NlsUpdateLocale+4928>
000007FEFD28ADAD 4881c4c8000000           add    $0xc8,%rsp

and I have no clue where i crashes, but I presume it is in sdl2.dll
Downloaded the latest 64 bit for win at sdl.org (2.0.4)
searching throught the disk gives exactly 1 sdl2.dll

C:\>dir /s sdl2.dll
 Directory of C:\bnl\bin
2016-01-02  11:59         1 230 336 SDL2.dll
               1 File(s)      1 230 336 bytes
     Total Files Listed:
               1 File(s)      1 230 336 bytes
               0 Dir(s)  122 686 066 688 bytes free

Anyone has some ideas what to do.
Needless to say, google runtime error 217 gives no clear indication
on why it is complaining.

I had Lazarus 1.6 before, but downgraded because of
bug in databse interface reagrding floats.
(thread with subject "TPQConnection and float")

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160323/f10f0850/attachment-0002.html>

More information about the Lazarus mailing list