Which lead to other problems.
I already stated that you need to look at the routines where you call this function. In all those places you need to replace LongInt with Cardinal (or LongWord) too.
Actually the reason of my seems to be that FPC considers my signed longint to be unsigned.
Where does FPC consider your LongInt to be unsigned? You are trying to compare your LongInt to a value which can
never be in a LongInt. If you're comparing a variable to values like $FFFCCC73 you should make sure your variable itself is a unsigned long integer too (and not a signed long integer like you're using now).
Where in your program are you
assigning this value $FFFCCC73 ??? Is this coming from a function you made or an existing function? Look at
the definition of that function. You see it defines the result as LongWord or Cardinal and
not as LongInt because it can't put $FFFCCC73 in a LongInt without getting a rangecheck error there too.
You could use LongInt($FFFCCC73) in your case-statement but I wouldn't recommend it. It's not how it's supposed to work.
So look everywhere in your program where you are getting this errorcode back from some function and change the variable of that errorcode to a Cardinal or LongWord (
or whatever is defined by that function). After that also change the LongInt in your function to Cardinal or LongWord and now your using the unsigned 32bit everywhere (without getting any range check errors).
B.T.W. if the function where the errorcode comes from defines that if a negative error is returned it is an error then an signed long integer
is the correct variable. But in that case you shouldn't compare it to an unsigned value like $FFFCCC73.
In that case you could do the following:
function DAQmxErrorDescription (ErrorCode: LongInt): String;
begin
case ErrorCode of
0: Result:='DAQmxSuccess';
-209805: Result:='ErrorCOCannotKeepUpInHWTimedSinglePoint';
..
I noticed
this page stated for example DAQmxWriteDigitalU32-function returns a signed long integer:
The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.
So you would have to check for negative values and not positive values like you do now. (That's assuming your error comes from one of these functions)