This is the code produced by the Module Wizard? The code I've generated in my cases doesn't explicitly use $VPTR and things like "$VPTR = $VTBL + 9 * INT_PTR_KIND() ! Add routine table offset" which contain an explicit offset.
Instead it looks like this
SUBROUTINE $DUMCBICONN2_EndSignalDevice($OBJECT, $STATUS)
IMPLICIT NONE
INTEGER(INT_PTR_KIND()), INTENT(IN) :: $OBJECT ! Object Pointer
!DEC$ ATTRIBUTES VALUE :: $OBJECT
INTEGER(4), INTENT(OUT), OPTIONAL :: $STATUS ! Method status
!DEC$ ATTRIBUTES REFERENCE :: $STATUS
INTEGER(4) $$STATUS
INTEGER(INT_PTR_KIND()) invokeargs
invokeargs = AUTOALLOCATEINVOKEARGS()
$$STATUS = AUTOINVOKE($OBJECT, 44, invokeargs)
IF ($$STATUS == DISP_E_EXCEPTION) CALL $$DisplayError(invokeargs)
IF (PRESENT($STATUS)) $STATUS = $$STATUS
CALL AUTODEALLOCATEINVOKEARGS (invokeargs)
END SUBROUTINE $DUMCBICONN2_EndSignalDevice
Using the IVF routines for COM. In my example the AUTOINVOKE call has a 44 which corresponds to your offset of 9. Each of the routines of course has a unique offset into the table.





HRESULT 0x80004005 E_FAIL
This is a brief description of the project.
Contains of two libraries, one containing interfaces, other containing coclasses, COM visible.
Used Module Wizard to create modules out of these libraries.
Created COM objects using CLSIDs provided. Two methods from different objcts worked fine, but it brakes at third method that is no different than these two. This is the error I get:
"Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))"
I found that program goes inside the correct .f90 file, finds the right description of a method, but after viewing the Log file, I saw that program never enters the actual function. This is the part of the code which returns the error.
INTEGER(4) FUNCTION $IFlash_SetReferenceFluid($OBJECT, ReferenceFluid) IMPLICIT NONE
INTEGER(INT_PTR_KIND()), INTENT(IN) :: $OBJECT ! Object Pointer
!DEC$ ATTRIBUTES VALUE :: $OBJECT
INTEGER(INT_PTR_KIND()), INTENT(IN) :: ReferenceFluid ! IUnknown
!DEC$ ATTRIBUTES REFERENCE :: ReferenceFluid
INTEGER(4) $RETURN
INTEGER(INT_PTR_KIND()) $VTBL ! Interface Function Table
POINTER($VPTR, $VTBL)
$VPTR = $OBJECT ! Interface Function Table
$VPTR = $VTBL + 9 * INT_PTR_KIND() ! Add routine table offset
IFlash_SetReferenceFluid_PTR = $VTBL
$RETURN = IFlash_SetReferenceFluid($OBJECT, ReferenceFluid) !!!!!!!!!!!!!!!!!!!! THIS LINE RETURNS ERROR !!!!!!!!!!!!!!!!
$IFlash_SetReferenceFluid = $RETURN
END FUNCTION $IFlash_SetReferenceFluid
Thing is that I created sample programs in VB, C++, C#, HTML and they all work without a problem. I'm using Visual Studio 2010 and Intel Composer XE 2013.
Regards