- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page