PascalGameDevelopment/SDL2-for-Pascal

Where is the pcsize_t.

Closed this issue · 4 comments

I try to compile the units in Delphi, report error as follow:

[dcc32 Error] sdlrwops.inc(220): E2003 Undeclared identifier: 'pcsize_t'
[dcc32 Error] sdlrwops.inc(236): E2005 'pcsize_t' is not a type identifier
[dcc32 Error] ctypes.inc(94): E2240 $EXTERNALSYM and $NODEFINE not allowed for 'SIZE_T'; only global symbols
[dcc32 Fatal Error] SDL2Sample.dpr(9): F2063 Could not compile used unit 'sdl2.pas'
Failed

suve commented

Hi. Truth be told, most of us are using the Free Pascal Compiler, so Delphi compatibility is a bit untested. Looking at sdl2.pas, we probably goofed up, because the ctypes unit is included only when {$IFDEF FPC} is satisfied. Can you edit this part of the code (I assume that, since you're using Delphi, you're building for Windows) so the ctypes unit is always included and check if that fixes the issue?

I can't find pcsize_t in ctypes.inc.

suve commented
  {$IFNDEF WIN64}
    csize_t = cuint32;
  {$ELSE}
    csize_t = cuint64;
  {$ENDIF}

Just add pcsize_t = ^csize_t to ctypes.inc.

@achinastone Thanks for the report. As @suve mentioned, as Delphi support is not 100% guaranted, any report leading to better Delphi compatibility is highly desired.

Btw.: This issue is strongly related to the discussion #67.