At 12:35 PM 11/11/2010, John Kasunich wrote:
> > I'm not too familiar with comp, but typically, C code global variables
> > are declared outside the "main", and local variables are declared either
> > in the body, or in the function. Comp may differ?
>
>You are correct for normal C, but comp has some special conditions to
>deal with. There are three kinds of variables that might be needed in
>a HAL component:
>
>1) HAL objects, like pins or parameters. These must obviously be
>declared in a HAL specific way, and comp lets you do that.
>
>2) Variables which are not HAL objects, but which must retain their
>values from one execution of the component to the next. In normal
>C you could declare these inside the function as "static", or outside
>the function (with or without static). However, neither of those will
>work for a HAL component. Those C declarations give you one copy of
>the variable(s) that you declare. But a HAL component can be used
>more than once in a given configuration. If you have 4 copies of
>the "edge" component in your system, each one needs its own copies
>of the variables. So comp provides a mechanism to declare those
>variables, and behind the scenes it makes sure that each instance
>of the component has one.
>
>3) Variables that do not need to retain their value from one
>execution of the component to the next. These can be declared
>as normal C variables, inside the function. Variables inside a
>function that don't have "static" are created on the stack when
>the function is called, and discarded when the function returns.
>So each component gets its own variables, but they can't be used
>to store data from one execution to the next.
>
>Hope this helps,
>
>John Kasunich
>--
> John Kasunich
> [email protected]
John,
Thanks for the explanation. I have yet to play around with
comp so I wasn't really sure what happens inside there. Steve did
say it could get messy at times, and from what you talked about, I
can see why. ;-)
Mark
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users