iwcall

The iwcall declspec allows the programmer to select which function calls are interworking, regardless of whether CLARM or CLTHUMB is used. Using iwcall allows you to avoid link-time generation of interworking thunking routines.

Note   iwcall has no effect unless used on a function prototype visible to the caller.

The iwcall declspec does not cause the associated function to have an interworking return. To make an interworking return, use the -/QRinterwork-return - Enable Interworking flag.

To understand the use of the iwcall declspec, consider a .LIB file that contains a function main() that makes a call to a user-supplied function, the author of the library does not know whether the user will use CLTHUMB or CLARM to compile the user-supplied function. You can use __declspec(iwcall) on the prototype of the user-supplied function to enable the library to handle either case.

The following example shows this use of iwcall declspec for the user-supplied function myfunction().

__declspec(iwcall) int myfunction();
int main()
{
  return myfunction();
}

The following listing shows the code generated from this declspec when compiled with /QRarch - Specify Target Architecture.

  str       lr, [sp, #4]!
  ldr       r3, [pc, #8]
  mov       lr, pc
  bx        r3
  ldmia     sp!, {pc}
  DCD       |myfunction|

The following listing shows the code generated with the CLTHUMB compiler.

  push      {lr}
  ldr       r3, [pc, #0x2]
  mov       r12, r3
  bl        __r12_indirect
  pop       {pc}
  DCD       |myfunction|

See Also

Declspecs | iw16 | iw32 | /QRinterwork-return - Enable Interworking | /QRarch - Specify Target Architecture

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.