Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Header Generation    [ Add a report in this area ]  
Report #:  57613   Status: Closed
pascal functions/implementations using UInt64 as argument can not be resolved by linker
Project:  C++Builder Build #:  2288.42451
Version:    10.0 Submitted By:   Thomas Koos
Report Type:  Basic functionality failure Date Reported:  1/30/2008 8:09:37 AM
Severity:    Serious / Highly visible problem Last Updated: 9/9/2008 10:58:37 AM
Platform:    All versions Internal Tracking #:  
Resolution: Duplicate  Resolved in Build: : 12.0.2988.11541
Duplicate of:  57612
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
A pascal implemention using an argument type of UInt64 can not be called by any C/C++ source. The header generation generates a header using signed __int64 but the pascal compiler builds an intermediate with an unsigned __int64 signature. This fact lets the C++ linker fail to build the application.

See attached example.

See also QC #57612
Steps to Reproduce:
- create a pascal source containing method/function using UInt64 as argument
- use this pascal source in a C++ project (lib/project)
- try to call this...

See the attached example. It contains two cases:

1. Case (showing the error)

Build the project without any change will use the generated HPP file for the TestPas.pas source. This header uses __int64 and the compiler compiles it and builds an object intermediate calling the method using a (signed) __int64. But the pascal compiler correctly builds an object intermediate taking an unsigned __int64 as argument - so the linker will fail.

2. Case (proving the error source)

Comment out the preprocessor define of the ORIGINALHEADER symbol in front of the Mainform.cpp. This will include the attached, modified header file. The calling signature in the header file was changed manually to unsigned __int64. So the C++ compiler builds an object intermediate taking an unsigned __int64 argument, so the linker finds a match in the intermediates.
Do not use Int64 in any pascal source that can be called from C++


Change the arguments manually from "__int64" to "unsigned __int64" on any generated header manually - every time after generation.


Server Response from: ETNACODE01