Software Archive
Read-only legacy content
17061 Discussions

Fortran COM module wizard bug

upetersen16
Beginner
824 Views
We have discovered a problem with the COM module wizard: the wrapper code generated by the wizard does not re-initialise BSTR pointers used when retrieving output strings from COM calls, and this can cause heap errors and user breakpoint in NTDLL when debugging, as described in other messages in this forum.
As a work-around, we re-initialise BSTR pointers in all wrapper functions that use character string output parameters, i.e. set pointers to 0 as shown in the example below:
CHARACTER(LEN=*), INTENT(OUT) :: Name ! BSTR
!DEC$ ATTRIBUTES REFERENCE :: Name
INTEGER(4) $RETURN
INTEGER(INT_PTR_KIND()) $VTBL ! Interface Function Table
POINTER($VPTR, $VTBL)
INTEGER(INT_PTR_KIND()) $BSTR_Name ! BSTR
INTEGER(4) $STATUS
! ---------------------------
! Re-initialise BSTR pointer:
$BSTR_Name = 0
! --------------------
$VPTR = $OBJECT ! Interface Function Table
$VPTR = $VTBL + 88 ! Add routine table offset
ITSItem_GetName_PTR = $VTBL
$RETURN = ITSItem_GetName($OBJECT, $BSTR_Name)

We would greatly appreciate if some solution to this could be incorporated into the next compiler patch.
0 Kudos
3 Replies
Steven_L_Intel1
Employee
824 Views
You will need to send a detailed bug report to vf-support@compaq.com This user forum is not where official requests for support should go.

Steve
0 Kudos
upetersen16
Beginner
824 Views
I will do so, but I think that you should let the message stay anyway, because there may be others who encounter the same problem, and it shows them how to make a work-around.
0 Kudos
Steven_L_Intel1
Employee
824 Views
I never delete messages, unless they are clearly inappropriate. I just wanted you to understand that you would not be likely to get a response through the forum - the forum is not where you ask questions of Compaq.

Steve
0 Kudos
Reply