Problem Transferring Structures between Procedures
jjweimer
// PROCEDURE FRAC
#pragma rtGlobals=1 // Use modern global access method.
Static Structure MyStruct
variable tc
endstructure
Function ChangeStructure(ms)
STRUCT MyStruct &ms
ms.tc = 1
return 0
end
#pragma rtGlobals=1 // Use modern global access method.
Static Structure MyStruct
variable tc
endstructure
Function ChangeStructure(ms)
STRUCT MyStruct &ms
ms.tc = 1
return 0
end
// PROCEDURE FRIC
#pragma rtGlobals=1 // Use modern global access method.
Static Structure MyStruct
variable tc
endstructure
Function SendStructure()
STRUCT MyStruct ms
ms.tc = 0
ChangeStructure(ms)
return 0
end
#pragma rtGlobals=1 // Use modern global access method.
Static Structure MyStruct
variable tc
endstructure
Function SendStructure()
STRUCT MyStruct ms
ms.tc = 0
ChangeStructure(ms)
return 0
end
Trying to compile these gives an error message for Fric:SendStructure ... reference variable is of a different type. When SendStructure() and ChangeStructure(ms) are within the same procedure, I get no compile error.
What am I missing?
Igor 6.1.0.7 under Windows Vista.
June 26, 2009 at 09:45 am - Permalink
Oh! Duh! Not only that, but the Structure definition must not be static. The proper set up is ...
#pragma rtGlobals=1 // Use modern global access method.
Structure MyStruct
variable tc
endstructure
Function SendStructure()
STRUCT MyStruct ms
ms.tc = 0
ChangeStructure(ms)
return 0
end
and
#pragma rtGlobals=1 // Use modern global access method.
Function ChangeStructure(ms)
STRUCT MyStruct &ms
ms.tc = 1
return 0
end
Thanks!
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
June 29, 2009 at 06:16 am - Permalink