Skip to content

Commit d86a53f

Browse files
committed
fix #876: ThreadCall does not support subroutine with [U]Long type parameter
1 parent 1e66df8 commit d86a53f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Version 1.06.0
5353
- #844: Fix bug in -gen gcc due to duplicated type (struct) names in the main module and global namespace
5454
- #875: Fix bug where boolean variable to single/double conversion gives wrong sign on -gen gas -fpu x87 & sse
5555
- #872: Fix broken boolean bitfield runtime assignments from unsigned values
56+
- #876: ThreadCall does not support subroutine with [U]Long type parameter
5657
- Fixed inline asm procedure name mangling bug (missing underscore prefix) with -gen gcc -asm intel on dos/win32
5758

5859

src/compiler/rtl-system-thread.bas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ private function hThreadCallMapType _
6262
case FB_DATATYPE_BYTE, FB_DATATYPE_CHAR, FB_DATATYPE_UBYTE, _
6363
FB_DATATYPE_SHORT, FB_DATATYPE_WCHAR, FB_DATATYPE_USHORT, _
6464
FB_DATATYPE_INTEGER, FB_DATATYPE_ENUM, FB_DATATYPE_UINT, _
65+
FB_DATATYPE_LONG, FB_DATATYPE_ULONG, _
6566
FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT, _
6667
FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
6768
select case as const( typeGetSizeType( dtype ) )

tests/threads/threadcall.bas

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,17 @@ SUITE( fbc_tests.threads.threadcall_ )
4646
end extern
4747

4848
sub BigInt cdecl( byref i as integer, byref ui as uinteger, _
49-
byref l as longint, byref ul as ulongint )
49+
byref l as longint, byref ul as ulongint, _
50+
byref i4 as long, byref ui4 as ulong _
51+
)
5052

5153
' Output by reference
5254
i = 17
5355
ui = 3
5456
l = 16
5557
ul = 4
58+
i4 = 15
59+
ui4 = 5
5660
end sub
5761

5862
sub FloatStr ( byval s as single, byref d as double, byref s1 as string )
@@ -113,6 +117,7 @@ SUITE( fbc_tests.threads.threadcall_ )
113117
TEST( default )
114118
dim thread as any ptr
115119
dim i as integer, ui as uinteger, l as longint, ul as ulongint
120+
dim i4 as long, iu4 as ulong
116121
dim d as double
117122
dim as string s1, s2
118123
dim bv as integer ptr, cu as ComplexUDT, AnArray( 0 to 1 ) as string
@@ -128,7 +133,7 @@ SUITE( fbc_tests.threads.threadcall_ )
128133
SmallInt_Thread = threadcall SmallInt( 20, 1, 19, 2 )
129134
testWindowsMs_thread = threadcall testWindowsMs( )
130135
#endif
131-
BigInt_Thread = threadcall BigInt( i, ui, l, ul )
136+
BigInt_Thread = threadcall BigInt( i, ui, l, ul, i4, iu4 )
132137
s1 = "fourteen"
133138
FloatStr_Thread = threadcall FloatStr( 15.00, d, s1 )
134139
TypeArray_Thread = threadcall TypeArray( su, cu, AnArray(), byval @bv )
@@ -155,7 +160,7 @@ SUITE( fbc_tests.threads.threadcall_ )
155160
threadwait ONamespace_Thread
156161

157162
'' check byref args
158-
CU_ASSERT_TRUE( i = 17 and ui = 3 and l = 16 and ul = 4 )
163+
CU_ASSERT_TRUE( i = 17 and ui = 3 and l = 16 and ul = 4 and i4 = 15 and iu4 = 5 )
159164
CU_ASSERT_TRUE( d > 12.99 and d < 13.01 and s1 = "five" )
160165
CU_ASSERT_TRUE( cu.c(0) = 7 and cu.c(1) = 11 and cu.c(2) = 8 )
161166
CU_ASSERT_TRUE( cu.d = "ten" and AnArray(0) = "ten" )

0 commit comments

Comments
 (0)