IdObjectChecksOff.inc 812 B

123456789101112
  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. {$IFDEF FPC}
  10. {$PUSH}
  11. {$OBJECTCHECKS OFF}
  12. {$ENDIF}