views:

80

answers:

1

I`m trying to create a macro which would make easier to point to a structs member. Currently i am pointing to a structs member in assembly file using the STRUCT_NAME + offset method.

For example if i want to point structs third member,i would have to do it like this: STRUCT_NAME + 3.

This seems stupid way to do it, and if i insert more members in the struct, i have to update all the offset values in the code.

Is there a way to point using STRUCT_NAME + macro(struct_name, member_name) ?

I`m using texas instruments TMS320C28x hardware.

Thanks!

A: 

Your compiler should have the offsetof macro, not sure if you can use that from within inline-assembly though.

unwind