Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/Thread support
[ Add a report in this area ]
Report #:
102766
Status:
Closed
BeginThread should return NativeInt or THandle on Windows, not Integer
Project:
Delphi
Build #:
16.0.4358.45540
Version:
16.3
Submitted By:
Chris Rolliston
Report Type:
Basic functionality failure
Date Reported:
1/21/2012 7:05:07 AM
Severity:
Serious / Highly visible problem
Last Updated:
9/5/2012 8:02:13 PM
Platform:
All versions
Internal Tracking #:
289563
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
17.0.4625.53395
Duplicate of:
None
Voting and Rating
Overall Rating:
(1 Total Rating)
4.00 out of 5
Total Votes:
1
Description
BeginThread returns Integer, however it should be either NativeInt or THandle on Windows. This is because the 'real' return type is THandle (=NativeUInt). While CreateThread is correctly declared in Winapi.Windows, it is wrongly declared (for 64 bit) in the include file used by System.pas (WindowsAPIs.inc). (On Win64, Integer is a 32 bit value where NativeInt and THandle are both 64 bit values.)
While using THandle would be the most correct thing to do (cf. what was done to FileOpen and friends for XE2 RTM), using NativeInt would keep things as they were for both Win32 and OSX32. If NativeInt is used however, then the result of BeginThread when called in TThread.Create should really be cast to THandle on being assigned to FHandle.
//USc: This would be an interface breaking change.
Steps to Reproduce:
1. Look at the source.
2. Observe the mismatch in types.
By USc:
- open $(BDS)\source\rtl\sys\System.pas
- look for the Windows version of BeginThread (line 1670 for XE2 U#3) and check the return parameter
expected: it is THandle
actual: it is Integer
- open $(BDS)\source\rtl\sys\WindowsAPIs.inc
- look for CreateThread (line 403 for XE2 U#3) and check the return parameter
expected: it is THandle
actual: it is Integer
Workarounds
None
Attachment
None
Comments
None
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us