Share via


Code Size Considerations (Windows CE 5.0)

Send Feedback

Both declspec modifiers and linker-generated thunking routines add additional 32-bit words of text-space instruction.

In general, if a program contains only a few interworking functions, but the interworking functions are called from many places; a linker-generated thunking routine probably results in smaller overall code size.

If a program contains many different interworking functions, but the interworking functions are called from only a few places, using the iwcall or iw16 declspec results in code size similar to that required by a linker-generated thunking routine.

If code size efficiency is important, keep in mind the following additional word requirements:

  • The iwcall and iw16 declspecs require an additional 32-bit word of text-space instruction per interworking call.

    Because the function address must be placed into and loaded from the literal pool, the function address can add up to two 32-bit words of text space instruction to the space required by the linker-generated thunking routine.

    Because different load instructions can share a given literal pool entry, some function calls do not add words for a declspec. The literal pool entry can be loaded into a register that different BX instructions use without reloading the register.

  • Allowing the linker to generate a thunking routine for the ARM compiler requires three additional 32-bit words per called function but no additional words at the call sites. A linker-generated thunking routine for the THUMB compiler requires four words instead of three.

    Note   Regardless of how many different callers call a function, the linker generates only one interworking thunking routine per function call.

See Also

Linker-generated Thunking Routines | iwcall | iw16 | iw32

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.