? "external = ", SYS(3095,ox), "Internal ",ox.IDispatch DEFINE CLASS myclass AS session OLEPUBLIC PROCEDURE IDispatch RETURN SYS(3095,CreateObject("myserver.myclass")) ENDDEFINEthe pointers are different of course, cause your creating a temporary COM object in the line "RETURN SYS(..." which is released directly afterwards.
&& this PROCEDURE IDispatch RETURN SYS(3095,CreateObject("myserver.myclass")) && is the same as this PROCEDURE IDispatch LOCAL loObj loObj = CreateObject("myserver.myclass") RETURN SYS(3095,loObj) ENDPROCso IDispatch() would return a pointer that is invalid for subsequent use, which you can easily verify:
LOCAL IExternal, IInternal, ox, ox2 ox = CreateObject("myserver.myclass") && create the server object IExternal = SYS(3095,ox) IInternal = ox.IDispatch() ox2 = SYS(3096,IExternal) ? ox = ox2 ox2 = SYS(3096,IInternal) && this completly crashes VFP9 with error ".. pure virtual function call .. " cause the pointer isn't valid anymoreRegards