We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hey all,
I have a question relating to accessing C structure members from within an assembly module. I notice that the manual indicates that no type information from C modules is available to A51 modules (which makes sense). This leaves a bit of an ugly picture for the accessing of any external structures, however.
Does anyone have any clean method of getting the offsetof() an element within an assembly module? For the moment, I've hard-coded the byte offsets and put some notes in the source file not to rearrange the structure, but I find this unsatisfying. Any advice?
-Jay Daniel
We've done things like having an AWK script as part of the build process that, using a C header file with structure definitions as input, creates an assembly include file with the structure member names equated with their 'offsetof'. Using the C header file as a make dependency, the assembly include file gets automatically regenerated only when the C header file changes.
Dan,
Thanks for the advice. Using a script like that sounds like a solid way around it. I might not do it with an AWK script, but something similar should do the trick.