Home »
Public Forums »
archive »
Re: Help: definition of the structure in COMMON block
Re: Help: definition of the structure in COMMON block [message #14808] |
Sun, 28 March 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
VU KHAC Tri (tvk@info.fundp.ac.be) writes:
> I want to define a structured variable as global variable. So I think
> about using the COMMON block to share this variable with others
> procedures. However, IDL does not enable to use this variable in a
> procedure without declaration.
>
> pro A
> COMMON SHARE1, X ;how to define x as a structure ?
> X.a = 1
> X.b = 2
> end
>
> pro B
> COMMON SHARE1
> X.a = 4 ; this is not permitted
> X.b = 5
> end
>
>
> Does anyone know how to resolve this problem ?
You need a structure definition statement following the
COMMON declaration:
pro A
COMMON SHARE1, X ;how to define x as a structure ?
x = {A:0, B:0}
;^^^^^^^^^^^^^^^^
X.a = 1
X.b = 2
end
pro B
COMMON SHARE1
X.a = 4 ; this is not permitted
X.b = 5
end
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Current Time: Fri Oct 10 01:17:49 PDT 2025
Total time taken to generate the page: 0.47863 seconds