<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 13, 2015 at 10:21 AM, Graeme Geldenhuys <span dir="ltr"><<a href="mailto:mailinglists@geldenhuys.co.uk" target="_blank">mailinglists@geldenhuys.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">
</span>Sorry, but that is a false statement. It works for both COM and CORBA<br>
interfaces. Simply don't use the 'as' syntax - just cast it.<br></blockquote><div><br>Wait, how can a syntax "work", if not used? :)<br><br>Don't forget that Pascal is safe-type language. <br></div><div>So "as" has also intent of checking an interface for being castable to an object instance.<br></div><div><br>If an interface is originating from non-FPC environment (i.e. delphi, c++ or whatever langauge) such casting should fail.<br></div><div>This is not the case for OP, but should be used as good practices. <br></div><div></div><div><br></div><div>Please note that casting Interface to TObject via "as" was not originally in the compiler. It was eventually added for Delphi compatibility. Previously compiler would just fail with an error that interface is not castable to object at all (I.e. Delphi 7 won't allow the syntax as well)<br><br><a href="http://www.freepascal.org/docs-html/ref/refsu47.html#x141-15100012.8.7">http://www.freepascal.org/docs-html/ref/refsu47.html#x141-15100012.8.7</a><br></div><div></div><div></div><div></div><div> </div></div>thanks,<br></div><div class="gmail_extra">Dmitry<br><br></div><div class="gmail_extra">P.S. By the way, if different versions of FPC are used (i.e. an interface is loaded from a DLL) and then interface is typecasted to an object via "as". It might cause problems if TObject structures are different between host application and the library. But using interfaces only prevents the problem.<br></div></div>