IdObjectChecksOff.inc 952 B

12345678910111213141516
  1. // In FreePascal, if the -CR compiler option (Verify object method call validity) is enabled,
  2. // the compiler emits code to make class methods raise an error if their Self pointer is nil
  3. // (this is documented behavior), BUT the compiler will ALSO silently change object hard-casts
  4. // into the 'as' operator (this is undocumented behavior!). This change breaks any place that
  5. // Indy uses Accessor Classes to reach protected class members across unit boundaries. This is
  6. // usually not a problem when Indy is compiled into its own package, but if Indy's source is
  7. // compiled directly into a project that happens to be using -CR, this becomes a big problem.
  8. // So, we have to turn off that compiler option everywhere that Accessor Classes are being used...
  9. //
  10. // TODO: another solution is to use Class Helpers instead of Accessor classes. But older
  11. // compilers do not support Class Helpers...
  12. //
  13. {$IFDEF FPC}
  14. {$PUSH}
  15. {$OBJECTCHECKS OFF}
  16. {$ENDIF}