Skip to content

Commit c8b2e48

Browse files
Add TTLSDestructor function pointer and use it in SDL_TLSSet
1 parent e7a09e4 commit c8b2e48

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

units/sdlthread.inc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,15 @@ function SDL_TLSCreate: TSDL_TLSID; cdecl;
369369
function SDL_TLSGet(id: TSDL_TLSID): Pointer; cdecl;
370370
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSGet' {$ENDIF} {$ENDIF};
371371

372+
type
373+
{ SDL2-For-Pascal: This function pointer is introduced to specifiy the
374+
destructor pointer in the SDL_TLSSet function
375+
according to C headers.
376+
377+
The TTLSDestructor type itself is not defined
378+
by the original SDL2 headers. }
379+
TTLSDestructor = procedure(value: Pointer); cdecl;
380+
372381
{**
373382
* Set the current thread's value associated with a thread local storage ID.
374383
*
@@ -392,7 +401,7 @@ function SDL_TLSGet(id: TSDL_TLSID): Pointer; cdecl;
392401
* \sa SDL_TLSCreate
393402
* \sa SDL_TLSGet
394403
*}
395-
function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: Pointer): cint; cdecl;
404+
function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl;
396405
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSSet' {$ENDIF} {$ENDIF};
397406

398407
{**

0 commit comments

Comments
 (0)