Skip to content

Commit 1d87255

Browse files
FIX: It seems that not "everything" was dynamic linked like it should be, now it is ;)
1 parent 0d89f01 commit 1d87255

27 files changed

Lines changed: 730 additions & 150 deletions

units/sdl_runtime_linking.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,10 @@ Begin
911911
{$ENDIF}
912912
SDL_IsTablet := TSDL_IsTablet_func(GetProcAddress(LibHandle, 'SDL_IsTablet'));
913913
If Not assigned(SDL_IsTablet) Then result := false;
914+
SDL_PollEvent := TSDL_PollEvent_func(GetProcAddress(LibHandle, 'SDL_PollEvent'));
915+
If Not assigned(SDL_PollEvent) Then result := false;
916+
SDL_EventState := TSDL_EventState_func(GetProcAddress(LibHandle, 'SDL_EventState'));
917+
If Not assigned(SDL_EventState) Then result := false;
914918
SDL_GetWindowWMInfo := TSDL_GetWindowWMInfo_func(GetProcAddress(LibHandle, 'SDL_GetWindowWMInfo'));
915919
If Not assigned(SDL_GetWindowWMInfo) Then result := false;
916920
SDL_CreateThread := TSDL_CreateThread_func(GetProcAddress(LibHandle, 'SDL_CreateThread'));

units/sdlatomic.inc

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,43 @@ type
1717
{**
1818
* Try to lock a spin lock by setting it to a non-zero value.
1919
*}
20+
{$ifdef SDL_RUNTIME_LOADING}
21+
Type
22+
TSDL_AtomicTryLock_func = function (lock: PSDL_SpinLock): TSDL_bool; cdecl;
23+
Var
24+
SDL_AtomicTryLock : TSDL_AtomicTryLock_func = Nil;
25+
{$else}
2026
function SDL_AtomicTryLock(lock: PSDL_SpinLock): TSDL_bool; cdecl;
2127
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicTryLock' {$ENDIF} {$ENDIF};
28+
{$endif}
2229

2330
{**
2431
* Lock a spin lock by setting it to a non-zero value.
2532
*}
33+
{$ifdef SDL_RUNTIME_LOADING}
34+
Type
35+
TSDL_AtomicLock_func = function (lock: PSDL_SpinLock): TSDL_bool; cdecl;
36+
Var
37+
SDL_AtomicLock : TSDL_AtomicLock_func = Nil;
38+
{$else}
2639
function SDL_AtomicLock(lock: PSDL_SpinLock): TSDL_bool; cdecl;
2740
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicLock' {$ENDIF} {$ENDIF};
41+
{$endif}
2842

2943
{**
3044
* Unlock a spin lock by setting it to 0.
3145
*
3246
* Always returns immediately.
3347
*}
48+
{$ifdef SDL_RUNTIME_LOADING}
49+
Type
50+
TSDL_AtomicUnlock_proc = procedure (lock: PSDL_SpinLock); cdecl;
51+
Var
52+
SDL_AtomicUnlock : TSDL_AtomicUnlock_proc = Nil;
53+
{$else}
3454
procedure SDL_AtomicUnlock(lock: PSDL_SpinLock); cdecl;
3555
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicUnlock' {$ENDIF} {$ENDIF};
56+
{$endif}
3657

3758
{**
3859
* The compiler barrier prevents the compiler from reordering
@@ -54,30 +75,58 @@ type
5475
{**
5576
* Set an atomic variable to a new value if it is currently an old value.
5677
*}
57-
function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl;
78+
{$ifdef SDL_RUNTIME_LOADING}
79+
Type
80+
TSDL_AtomicCAS_func = function (atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl;
81+
Var
82+
SDL_AtomicCAS : TSDL_AtomicCAS_func = Nil;
83+
{$else}
84+
function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl;
5885
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCAS' {$ENDIF} {$ENDIF};
86+
{$endif}
5987

6088
{**
6189
* Set an atomic variable to a new value and return the old one.
6290
*
6391
* This function also acts as a full memory barrier.
6492
*}
65-
function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl;
93+
{$ifdef SDL_RUNTIME_LOADING}
94+
Type
95+
TSDL_AtomicSet_func = function (atomic: PSDL_Atomic; value: cint): cint; cdecl;
96+
Var
97+
SDL_AtomicSet : TSDL_AtomicSet_func = Nil;
98+
{$else}
99+
function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl;
66100
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSet' {$ENDIF} {$ENDIF};
101+
{$endif}
67102

68103
{**
69104
* Get the value of an atomic variable.
70105
*}
71-
function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl;
106+
{$ifdef SDL_RUNTIME_LOADING}
107+
Type
108+
TSDL_AtomicGet_func = function (atomic: PSDL_Atomic): cint; cdecl;
109+
Var
110+
SDL_AtomicGet : TSDL_AtomicGet_func = Nil;
111+
{$else}
112+
function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl;
72113
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGet' {$ENDIF} {$ENDIF};
114+
{$endif}
73115

74116
{**
75117
* Add to an atomic variable, and return the old value.
76118
*
77119
* This function also acts as a full memory barrier.
78120
*}
79-
function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl;
121+
{$ifdef SDL_RUNTIME_LOADING}
122+
Type
123+
TSDL_AtomicAdd_func = function (atomic: PSDL_Atomic; value: cint): cint; cdecl;
124+
Var
125+
SDL_AtomicAdd : TSDL_AtomicAdd_func = Nil;
126+
{$else}
127+
function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl;
80128
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicAdd' {$ENDIF} {$ENDIF};
129+
{$endif}
81130

82131
{**
83132
* Increment an atomic variable used as a reference count.
@@ -92,18 +141,39 @@ function SDL_AtomicDecRef(atomic: PSDL_Atomic): Boolean;
92141
{**
93142
* Set a pointer to a new value if it is currently an old value.
94143
*}
144+
{$ifdef SDL_RUNTIME_LOADING}
145+
Type
146+
TSDL_AtomicCASPtr_func = function (ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl;
147+
Var
148+
SDL_AtomicCASPtr : TSDL_AtomicCASPtr_func = Nil;
149+
{$else}
95150
function SDL_AtomicCASPtr(ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl;
96151
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCASPtr' {$ENDIF} {$ENDIF};
152+
{$endif}
97153

98154
{**
99155
* Set a pointer to a new value atomically, and return the old value.
100156
*}
157+
{$ifdef SDL_RUNTIME_LOADING}
158+
Type
159+
TSDL_AtomicSetPtr_func = function (ptr: PPointer; value: Pointer): Pointer; cdecl;
160+
Var
161+
SDL_AtomicSetPtr : TSDL_AtomicSetPtr_func = Nil;
162+
{$else}
101163
function SDL_AtomicSetPtr(ptr: PPointer; value: Pointer): Pointer; cdecl;
102164
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSetPtr' {$ENDIF} {$ENDIF};
165+
{$endif}
103166

104167
{**
105168
* Get the value of a pointer atomically.
106169
*}
170+
{$ifdef SDL_RUNTIME_LOADING}
171+
Type
172+
TSDL_AtomicGetPtr_func = function (ptr: PPointer): Pointer; cdecl;
173+
Var
174+
SDL_AtomicGetPtr : TSDL_AtomicGetPtr_func = Nil;
175+
{$else}
107176
function SDL_AtomicGetPtr(ptr: PPointer): Pointer; cdecl;
108177
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGetPtr' {$ENDIF} {$ENDIF};
178+
{$endif}
109179

units/sdlaudio.inc

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,15 @@ type
219219
*
220220
* \sa SDL_GetAudioDriver
221221
*}
222+
{$ifdef SDL_RUNTIME_LOADING}
223+
Type
224+
TSDL_GetNumAudioDrivers_func = function : cint; cdecl;
225+
Var
226+
SDL_GetNumAudioDrivers : TSDL_GetNumAudioDrivers_func = Nil;
227+
{$else}
222228
function SDL_GetNumAudioDrivers: cint; cdecl;
223229
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDrivers' {$ENDIF} {$ENDIF};
230+
{$endif}
224231

225232
{**
226233
* Use this function to get the name of a built in audio driver.
@@ -299,9 +306,15 @@ function SDL_AudioInit(driver_name: PAnsiChar): cint; cdecl;
299306
*
300307
* \sa SDL_AudioInit
301308
*}
309+
{$ifdef SDL_RUNTIME_LOADING}
310+
Type
311+
TSDL_AudioQuit_proc = procedure ; cdecl;
312+
Var
313+
SDL_AudioQuit : TSDL_AudioQuit_proc = Nil;
314+
{$else}
302315
procedure SDL_AudioQuit; cdecl;
303316
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioQuit' {$ENDIF} {$ENDIF};
304-
317+
{$endif}
305318
{**
306319
* Get the name of the current audio driver.
307320
*
@@ -318,9 +331,15 @@ procedure SDL_AudioQuit; cdecl;
318331
*
319332
* \sa SDL_AudioInit
320333
*}
334+
{$ifdef SDL_RUNTIME_LOADING}
335+
Type
336+
TSDL_GetCurrentAudioDriver_func = function : PAnsiChar; cdecl;
337+
Var
338+
SDL_GetCurrentAudioDriver : TSDL_GetCurrentAudioDriver_func = Nil;
339+
{$else}
321340
function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl;
322341
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentAudioDriver' {$ENDIF} {$ENDIF};
323-
342+
{$endif}
324343
{**
325344
* This function is a legacy means of opening the audio device.
326345
*
@@ -723,8 +742,15 @@ const
723742
*
724743
* \sa SDL_GetAudioDeviceStatus
725744
*}
726-
function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl;
745+
{$ifdef SDL_RUNTIME_LOADING}
746+
Type
747+
TSDL_GetAudioStatus_func = function : TSDL_AudioStatus; cdecl;
748+
Var
749+
SDL_GetAudioStatus : TSDL_GetAudioStatus_func = Nil;
750+
{$else}
751+
function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl;
727752
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioStatus' {$ENDIF} {$ENDIF};
753+
{$endif}
728754

729755
{**
730756
* Use this function to get the current audio state of an audio device.
@@ -1572,8 +1598,15 @@ procedure SDL_ClearQueuedAudio(dev: TSDL_AudioDeviceID); cdecl;
15721598
* \sa SDL_UnlockAudio
15731599
* \sa SDL_UnlockAudioDevice
15741600
*}
1601+
{$ifdef SDL_RUNTIME_LOADING}
1602+
Type
1603+
TSDL_LockAudio_proc = procedure ; cdecl;
1604+
Var
1605+
SDL_LockAudio : TSDL_LockAudio_proc = Nil;
1606+
{$else}
15751607
procedure SDL_LockAudio; cdecl;
15761608
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudio' {$ENDIF} {$ENDIF};
1609+
{$endif}
15771610

15781611
{**
15791612
* Use this function to lock out the audio callback function for a specified
@@ -1640,9 +1673,15 @@ procedure SDL_LockAudioDevice(dev: TSDL_AudioDeviceID); cdecl;
16401673
* \sa SDL_LockAudio
16411674
* \sa SDL_UnlockAudioDevice
16421675
*}
1676+
{$ifdef SDL_RUNTIME_LOADING}
1677+
Type
1678+
TSDL_UnlockAudio_proc = procedure ; cdecl;
1679+
Var
1680+
SDL_UnlockAudio : TSDL_UnlockAudio_proc = Nil;
1681+
{$else}
16431682
procedure SDL_UnlockAudio; cdecl;
16441683
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Unlock' {$ENDIF} {$ENDIF};
1645-
1684+
{$endif}
16461685
{**
16471686
* Use this function to unlock the audio callback function for a specified
16481687
* device.
@@ -1683,9 +1722,15 @@ procedure SDL_UnlockAudioDevice(dev: TSDL_AudioDeviceID); cdecl;
16831722
*
16841723
* \sa SDL_OpenAudio
16851724
*}
1725+
{$ifdef SDL_RUNTIME_LOADING}
1726+
Type
1727+
TSDL_CloseAudio_proc = procedure ; cdecl;
1728+
Var
1729+
SDL_CloseAudio : TSDL_CloseAudio_proc = Nil;
1730+
{$else}
16861731
procedure SDL_CloseAudio; cdecl;
16871732
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudio' {$ENDIF} {$ENDIF};
1688-
1733+
{$endif}
16891734
{**
16901735
* Use this function to shut down audio processing and close the audio device.
16911736
*

units/sdlcpuinfo.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function SDL_GetCPUCount(): cint; cdecl;
2828
* This is useful for determining multi-threaded structure padding
2929
* or SIMD prefetch sizes.
3030
*}
31+
{$ifdef SDL_RUNTIME_LOADING}
32+
// TODO: Portieren
33+
{$else}
3134
function SDL_GetCPUCacheLineSize(): cint; cdecl;
3235
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCacheLineSize' {$ENDIF} {$ENDIF};
3336

@@ -221,3 +224,4 @@ function SDL_SIMDRealloc(mem: Pointer; const len: csize_t): Pointer; cdecl;
221224
procedure SDL_SIMDFree(mem: Pointer); cdecl;
222225
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDFree' {$ENDIF} {$ENDIF};
223226

227+
{$endif}

units/sdlerror.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@ function SDL_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl;
3535
*
3636
* \return a pointer to the last error message that was set
3737
*}
38+
{$ifdef SDL_RUNTIME_LOADING}
39+
Type
40+
TSDL_GetError_func = function (): PAnsiChar; cdecl;
41+
Var
42+
SDL_GetError : TSDL_GetError_func = Nil;
43+
{$else}
3844
function SDL_GetError: PAnsiChar; cdecl;
3945
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF} {$ENDIF};
46+
{$endif}
4047

4148
{**
4249
* \brief Get the last error message that was set for the current thread
@@ -64,7 +71,14 @@ function SDL_GetErrorMsg(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdec
6471
{**
6572
* \brief Clear the error message for the current thread
6673
*}
74+
{$ifdef SDL_RUNTIME_LOADING}
75+
Type
76+
TSDL_ClearError_proc = procedure () cdecl;
77+
Var
78+
SDL_ClearError : TSDL_ClearError_proc = Nil;
79+
{$else}
6780
procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF};
81+
{$endif}
6882

6983
{*Internal error functions*}
7084
{**

0 commit comments

Comments
 (0)