[fpc-pascal] -CR Command line switch and Firebird.pas

Tony Whyman tony.whyman at mccallumwhyman.com
Sun Mar 4 15:38:56 CET 2018

Is there anyway of turning off the command line switch -CR 
(Verify object method call validity) on a per unit basis in the same way 
that -Cr (range checking) can be turned off using {$R-}? I can't see any 
such directive in the FPC documentation.

As the title suggests, I have a specific problem in mind with the 
Firebird.pas file distributed with the Firebird source code. The code in 
this unit maps a C++ vtable into Pascal method calls (its not nice but 
it works). Not surprisingly when a program is compiled with -CR you 
always get a runtime error when a call is made to the Firebird 3 API, It 
ain't a Pascal vtable and whatever test the compiler uses fails.

I don't see a way around the Firebird.pas approach for calling the 
Firebird 3 API from a Pascal program and if there is no way of turning 
off this check on a per unit basis the -CR switch is probably unusable 
with any program that uses the Firebird 3 API.

Tony Whyman


More information about the fpc-pascal mailing list