Share via


/QRinterwork-return - Enable Interworking

9/7/2007

This option instructs the compiler to generate code that enables programs to call functions from ARM or Thumb mode and return correctly.

In other words, the /QRinterwork-return flag makes it possible to compile code that works in both 16-bit and 32-bit mode. That is, when you compile a 32-bit function using this flag, the compiler generates a function that can be called from a function running in 16-bit mode, and vice-versa. For example, a 32-bit function compiled with /QRinterwork-return would return with the instruction BX LR instead of MOV PC, LR. Such a function can be successfully called from 16-bit code, and is therefore referred to as interworking.

The I in the ARMV4I name means Interworking. For Windows CE 5.0 and later, ARMV4 is deprecated and all supported ARM processors are ARMV4I by default. /QRarch4T and /QRarch5T switches now enable /QRinterwork-return, to avoid generating code that might not run correctly if the user forgot to add /QRinterwork-return.

By enabling interworking, Microsoft is complying with the ARM goal of deprecating non-interworking ARM architecture. 16-bit and 32-bit code should be supported on all ARM platforms.

Note

Because the quality of the code generated with the /QRinterwork-return switch is not as good for ARM Architecture Version 4 as code generated with /QRarch4T, you can disable /QRinterwork-return. However, do not disable /QRinterwork-return unless you are sure that no interworking is necessary.

If the code needs to be compatible only with ARMv5 and later, returns for procedure call can use BX, LDR, or LDM, but not MOV.

For example,

  • LDM SP!, { ... PC } should be changed to LDM SP!, { ... LR }; BX LR.  (Not required for ARMv5+)
  • MOV PC, LR should be changed to BX LR.

See Also

Concepts

THUMB-enabled ARM Implementation