I am trying to use the Intel Visual Fortran Module Wizard to generate code to interact with a VB.net assembly which implements a COM interface. The assembly is registered on the computer but not in the GAC. The COM interface was created by the compiler and not explicitly. COM works fine with MS Excel and other applications. Im having trouble getting it to work in my Fortran project.
It seems like the module wizard generated the interfaces fine but when I try to call one of the functions I get the following error message:
Unhandled exception at 0x0040a8cd in spxctselect.exe: 0xC0000005:
Access violation reading location 0x00000001.
This happens when the following statement is executed:
$$STATUS = AUTOINVOKE($OBJECT, 1610743814, invokeargs)
The statement is executed in the following code which was generated by the wizard:
LOGICAL(2) FUNCTION $Application_Initialize($OBJECT, UserName, PassCode, DataFile, $STATUS)
IMPLICIT NONE
INTEGER(INT_PTR_KIND()), INTENT(IN) :: $OBJECT ! Object Pointer
!DEC$ ATTRIBUTES VALUE :: $OBJECT
CHARACTER(LEN=*), INTENT(IN) :: UserName ! BSTR
CHARACTER(LEN=*), INTENT(IN) :: PassCode ! BSTR
CHARACTER(LEN=*), INTENT(IN) :: DataFile ! BSTR
INTEGER(4), INTENT(OUT), OPTIONAL :: $STATUS ! Method status
!DEC$ ATTRIBUTES REFERENCE :: $STATUS
LOGICAL(2), VOLATILE :: $RETURN
INTEGER(4) $$STATUS
INTEGER(INT_PTR_KIND()) invokeargs
invokeargs = AUTOALLOCATEINVOKEARGS()
CALL AUTOADDARG(invokeargs, '$RETURN', $RETURN)
CALL AUTOADDARG(invokeargs, '$ARG1', UserName, AUTO_ARG_IN, VT_BSTR)
CALL AUTOADDARG(invokeargs, '$ARG2', PassCode, AUTO_ARG_IN, VT_BSTR)
CALL AUTOADDARG(invokeargs, '$ARG3', DataFile, AUTO_ARG_IN, VT_BSTR)
$$STATUS = AUTOINVOKE($OBJECT, 1610743814, invokeargs)
IF ($$STATUS == DISP_E_EXCEPTION) CALL $$DisplayError(invokeargs)
IF (PRESENT($STATUS)) $STATUS = $$STATUS
$Application_Initialize = $RETURN
CALL AUTODEALLOCATEINVOKEARGS (invokeargs)
END FUNCTION $Application_Initialize
If anyone has any suggestions or an idea of what the problem may be it would be greatly appreciated.


