## PRB: Can't Load Debugee with Multiple Data Segments

Q117793

    1.00 1.50
    WINDOWS
    kbtool kbprb

    ----------------------------------------------------------------------
    The information in this article applies to:

     - The Visual Workbench Integrated Debugger included with:
       Microsoft Visual C++ for Windows, versions 1.0 and 1.5
    ----------------------------------------------------------------------

    SYMPTOMS
    ========

    When you attempt to debug a large-model Windows-based application in the
    debugger, the following error message displays:

       Could not load debuggee. Debuggee contains multiple writable data
       segments (16)

    CAUSE
    =====

    This error message occurs when you try to debug an application containing
    more than one data segment when another instance of the same application is
    already running. The problem is that 16-bit Windows does not allow more
    than one instance of an application containing multiple data segments to
    run. Furthermore, because Visual C++ runs in the 16-bit Windows-on-Windows
    (WOW) layer in Windows NT, the same error can occur there.

    RESOLUTION
    ==========

    The easiest solution is to make sure that no instances of your program
    are running before you begin the debugging session.

    If it is important to run multiple instances of your program, create a
    medium-memory model application or force all data near by using the
    /Gx and /Gt compile options.

    NOTE: These options work only if the application's static data, string
    literals, stack, and heap all fit into one 64K segment.

    The /Gx option causes the compiler to force static data into the
    default data segment, which results in the application having only one
    data segment (this is turned on by default in Visual C++).

    The /Gt switch specifies the size that a static object must be to have its
    own data segment. When trying to create a single data segment, this
    threshold value should be large enough to ensure that no data objects are
    allocated outside of the default data segment. If the /Gt option is not
    specified, the data threshold will be 32767 bytes. You should only have to
    use this option if you have data structures that exceed 32767 bytes.

    MORE INFORMATION
    ================

    The reason that Windows does not allow more than one instance of an
    application containing multiple data segments to run is that the Windows
    loader cannot fix up multiple instances of far pointers because the code is
    shared among all instances of an application.

    For more detailed information concerning multiple instances of large-model
    programs, see article Q90294, here in the Microsoft Knowledge Base.

    Additional reference words: IDE 1.00 1.50 debuggee
    KBCategory: kbtool kbprb
    KBSubcategory: WBDebug

Keywords : kb16bitonly
Issue type :
Technology :

Last Reviewed: July 25, 1997 © 2001 Microsoft Corporation. All rights reserved. Terms of Use.