Partager via


/QRinterwork-return - Enable Interworking (Windows CE 5.0)

Send Feedback

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.

Microsoft recommends compiling all firmware loaded on a Windows Mobile-based device with interworking enabled. If interworking it not enabled and library and system entry points are compiled as 16-bit, non-interworking code will no longer run.

When migrating assembly language routines from Pocket PC 2003 SE to Windows Mobile 5.0, make sure that assembly code is compatible with ARMv4 interworking. In this case, all procedure call return sequences must use the BX instruction.

If the code needs to be compatible only with ARMv5 and later, procedure call returns 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.

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.