forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pointers, pointers, pointers!

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
KennyT



Joined: 02 Aug 2005
Posts: 317

PostPosted: Thu Jan 12, 2012 1:25 pm    Post subject: Pointers, pointers, pointers! Reply with quote

Got a wierd situation. I have a routine (QW_SetAdr defined in a separate DLL) that displays a value on the screen. When it is passed a variable defined through a pointer to a structure variable, it behaves inconsistently. So, to give a coding example:

In the following, CPH is defined in a module and populated elsewhere

Code:
TYPE(PHRES), POINTER :: PH
.
.
PH=>CPH
.
.
CALL QW_SetADR (IS, IFLD, PH%Avalue)

Fails to update the field on the screen cleanly.

But…
Code:
TYPE(PHRES), POINTER :: PH
.
.
PH=>CPH
.
.
AVALUE = PH%Avalue
CALL QW_SetADR (IS, IFLD, Avalue)

…Works

And…
Code:
TYPE(PHRES)          :: PH
.
.
PH=CPH
.
.
CALL QW_SetADR (IS, IFLD, PH%Avalue)

…Works as well

If I try stepping through the code under /debug, it all works OK, but if I just run the app, regardless of whether the relevant code is compiled under /debug or not, sometimes it works, sometimes it doesn't.

Any ideas?

TIA


K
Back to top
View user's profile Send private message Visit poster's website
KennyT



Joined: 02 Aug 2005
Posts: 317

PostPosted: Thu Jan 12, 2012 2:49 pm    Post subject: Reply with quote

OK, sussed it! The routine that displays the value is using the LOC of the variable and was testing for that being .le.0, and, of course, under 64-bit OS, the 4-byte addresses can and do go negative!

K
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group