Share via


Replacement Floating Point C Run-Time Library Creation Overview

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/27/2008

The standard floating point C run-time library, Fpcrt.dll, contains and exports the public C run-time floating point APIs. It also contains and exports internally used floating point support functions.

In Windows Embedded CE 6.0, ARM processors now have a Fpcrt.dll that is separate from Coredll.dll, and which contains and exports both public and internal support floating point functions. There is no import library associated with this version of Fpcrt.dll, and the binaries use the same import libraries as before when referencing Coredll.dll. This separation of Fpcrt.dll from Coredll.dll faciliates the creation of a replacement floating point C run-time library.

Note

In ARMv4 architectures, all the exports from Fpcrt.dll must be 32 bit ARM code, not Thumb. This requirement does not apply to ARMv5 and later architectures.

Coredll.dll still contains the same exports for the floating point functions, but the boot loader forwards these exports to the equivalent exports in Fpcrt.dll using ordinals.

Note

Because these exports use ordinals, you must make sure that a replacement floating point C run-time library matches the correct ordinals in its exports.

For more information about these exports, see Exports from the Floating Point C Run-Time Library.

The current boot loader handles implicit .dll dependencies based on the individual exports that are actually referenced. This means that Fpcrt.dll is loaded only when an application references the floating point exports from Coredll.dll. K.Coredll.dll, which is the kernel version of Coredll.dll, displays the same behavior and forwards its exports to the kernel version of Fpcrt.dll, K.Fpcrt.dll.

The following illustration shows the position of Fpcrt.dll in relation to Coredll.dll and application executables or libraries.

Bb330862.2232f3f1-e55d-40d1-998e-947195bcce0b(en-US,WinEmbedded.60).gif

Best Practices for Replacement FPCRT Creation

  • When creating a replacement Fpcrt.dll library, you can choose to reuse two of the existing libraries that the standard Fpcrt.dll contains, Ccrtcmtr.lib and Ccrttran.lib. These libraries contain implementations for a subset of the required exports, which are mostly transcendental functions, so reimplementing the functions in these libraries is optional.
    If you choose to reuse these libraries, you must ensure that the names for functions other than the ordinals match the names used in this documentation. This is because the implementations in Ccrtcmtr.lib and Ccrttran.lib reference some of the other floating point functions by name.
    You must also define the following function, which takes the same arguments as the Win32 API RaiseException(). A minimal implementation can just call RaiseException() using the same arguments.

    void __crtRaiseException(
        DWORD dwExceptionCode,
        DWORD dwExceptionFlags,
        DWORD nNumberOfArguments,
        CONST DWORD *lpArguments)
    

    While Fpcrt.dll can use any other libraries and .dlls, it must also link to the Coredll.lib and Corelibc.lib libraries.

  • For information about the internal, required, and reusable functions that you can include in a replacement floating point C run-time library, see Floating Point C Run-Time Library API Reference.

  • Except where explicitly noted, all floating point operations must follow the current floating point control flags that _controlfp() and _controlfp_s() set.
    You can choose to implement these flags process-wide as global data, or as per-thread using thread local storage. If the hardware registers are used, make sure that the target OS implements saving and restoring these registers as part of the thread context.

  • If you choose to support floating point exceptions, you can use the function RaiseException() to throw the exceptions using the following values as the exception code.
    EXCEPTION_FLT_DENORMAL_OPERAND
    EXCEPTION_FLT_DIVIDE_BY_ZERO
    EXCEPTION_FLT_INEXACT_RESULT
    EXCEPTION_FLT_INVALID_OPERATION
    EXCEPTION_FLT_OVERFLOW
    EXCEPTION_FLT_STACK_CHECK
    EXCEPTION_FLT_UNDERFLOW

After Replacement FPCRT Library Creation

For information about implementing the application binary interface, see Guidelines for Implementing the Application Binary Interface.

After you have created a replacement floating point C run-time library, you are ready to include it in a run-time image. For information, see Including a Replacement Floating Point C Run-Time Library in a Run-Time Image.

See Also

Other Resources

Replacement Floating Point C Run-Time Library