Symbol data size

Using the vxWorks API symFind (), we can get the address of a global variable by knowing its name. Is there a way to find out the corresponding character size?

The point is that the character I am looking for can be of any type and I need to find it at runtime. So I basically can't use the sizeof directive.


source to share

1 answer

This is not possible, because when you add a symbol, you never specify its size: the function symAdd

only accepts a SYMTAB_ID

name, address, type id, and group id. Some of the predefined type identifiers imply size (or at least imply enough information that you could examine the data at the address and print the size), but other predefined type identifiers do not; and even if everyone did, the API still wouldn't have any way of knowing about user-defined types (since it just considers them to be opaque integer IDs).



All Articles