- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suspect I discovered another couple of bugs on IVF while porting XFT to IVF8. I have the latest release (047+048 patch). The first is related with FUNCTION returning POINTER. Explicit interfaces all around:
FUNCTION XCreateWindow(...xParent...) TYPE(X_WINDOW):: xParent ... END FUNCTION XCreateWindow !===================== FUNCTION XGetWindow() RESULT(xWnd) TYPE(X_WINDOW), POINTER:: xWnd TYPE(X_WINDOW), SAVE, TARGET:: xLocal ... xWnd=>xLocal ... END FUNCTION XGetWindow !===================== ... i = XCreateWindow(...XGetWindow()...)
I suppose that at the end of story -- provided that the code is legal, xParent and xLocal should be associated. However, that is not the case; instead of LOC(xLocal), what is being passed to XCreateWindow is LOC(LOC(xLocal)) (if you know what I mean), i.e. address of the pointer itself rather than its target.
The workaround is to insert a temporary variable in the calling code:
TYPE(X_WINDOW),POINTER:: xTemp ... xTemp=>XGetWindow() i = XCreateWindow(...xTemp...)
Jugoslav
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm still scratching my head on the second one:
CHARACTER, ALLOCATABLE:: sText(:) ... iLen = SendMessage(xCtl%hWnd, CB_GETLBTEXTLEN, iSel, 0) ALLOCATE(sText(iLen+1)) iSt = SendMessage(xCtl%hWnd, CB_GETLBTEXT, iSel, LOC(sText)) iSt = SendMessage(xCtl%hWnd, WM_SETTEXT, 0, LOC(sText)) DEALLOCATE(sText)
On return from CB_GETLBTEXT, LOC(sText) is screwed. DEALLOCATE(sText) fails. If I replace sText to be a non-allocatable array of sufficient size, it works all OK.
I have a hunch thatthis oneis related with the one above. If I watch LOC(sText) in the code above, after return from SendMessage, it changes value to 0x286e6973, which exactly matches first 4 bytes of combo box contents - "sin(". It appears that instead of LOC(sText), address of descriptor is incorrectly passed to SendMessage.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav, perhaps it's because I'm still working on my first coffee of the morning, but I'm having trouble understanding what you're doing here, and am not sure if it's legal. If possible, please create a small, self-contained test case and submit it to Premier Support. Then send me an e-mail with the case number. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No problem Steve, I'm working on creating a smaller sample.
Another Saturday worker, ha? :-(
Jugoslav

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