

First Aid Kit
-------------


Q:  When I start my program, it says in cannot find "Swallow.Drv" and aborts!
A:  "Swallow.Drv" is the file containing DOS-Extender. It must be in the path
    of the EXE-file or in a directory set by the "PATH"-environment variable.

Q:  I included Swallow into my program, anything was compiled correctly, but
    when I try to start it, an error message about something like "Segment
    Description File..." appears!
A:  To load your program into extended memory Swallow needs the above
    mentioned file. You have to create it after each linking by calling the
    SegReg.Exe program; calling convention:
      "SEGREG programname", e.g. "SEGREG PRIME"

Q:  I created such a "Segment Description File", but an error about it appears
    again!
A:  You have to create this file after each linking.

Q:  My program worked correctly, but after some little changes I get some
    strange error messages when I try to start it!
A:  You have to create a "Segment Description File" after each linking. If you
    forget it, your program will be loaded incorrect and so unbelievable and
    strange error messages will be shown.

Q:  At runtime I get thousands of error messages like "General Protection
    Fault", "Segment not present" or anything else. What's wrong?
A:  In Protected Mode anything you do is observed by the CPU. Obviously your
    program has many mistakes, which are perhaps unimportant but recognised by
    the CPU. Now you have to remove all these mistakes, so sorry.

Q:  When I include a unit, e.g. CRT, an error messages at runtime occur.
A:  It seems you included "Swallow" not as the first unit of your main
    program. It has to stand even before "CRT" or any other unit, e.g.
      "uses Swallow, CRT, DOS".

Q:  I tried to execute a Turbo Vision application with Swallow, but I got
    error messages from inside Turbo Vision.
A:  Turbo Vision is not Protected Mode compatible, but there is a Turbo Pascal
    patch bundled with Swallow: "SwaTV1" and "SwaTV2". You have to link
    "SwaTV1" for Turbo Vision 1 and "SwaTV2" for Turbo Vision 2 to your main
    program as the second unit, directly after "Swallow", e.g.
      "uses Swallow, SwaTV2" for Turbo Vision 2.

Q:  I'm using Borland's BGI drivers, but during "InitGraph" an error message
    appears!
A:  So sorry: you cannot use Borland's BGI drivers with Swallow, they are too
    incompatible with Protected Mode.

Q:  My program works in PM, but after a while it terminates with the message
    "Out of descriptors", but there is enough free memory left!?
A:  Normally all your data blocks are handled by a separate descriptor. That's
    very save but allows only 8192 blocks. Solution: call
    "UseUnwatchedMem(true)" in Pascal and "UseUnwatchedMem(1)" in C.

Q:  When I load my program into the external debugger an error message
    "Breakpoint" appears, even before I start it and so I cannot do anything!
A:  If you load a "C" program into the external debugger, the start-up code
    will be executed even before the message "Program Loaded" appears. Because
    this code switches your program into Protected Mode, any further access by
    your debugger will be denied by the CPU. Look at the next question to get
    the solution.

Q:  I cannot debug my program! When I execute the first instruction, an error
    message "Breakpoint " appears.
A:  You found the main problem of Protected Mode: it is so protected that even
    a debugger cannot control your program. If you want to use a debugger, you
    have to remove Swallow from your program or to start it with the command
    line option "/Real" (it can be set under "Run|Parameters..."). The latter
    one forces Swallow to load its own Real Mode Emulator, which supports
    (nearby) all functions of Swallow but works in Real Mode and so it is
    debugger-compatible.

Q:  Hey, it works! But my DOS-memory disappears after debugging!?
A:  Some debuggers (especially the external debuggers) have problems to
    release the DOS memory allocated by the Real Mode Emulator if you terminate
    the program by hand. To avoid this, you have to remove Swallow completely
    or to
      Pascal: set the compiler option "NoSwallow" and recompile "Swallow.Pas"
              to deny loading of Swallow.
      C:      define "__NOSWALLOW", compile "Swallow.C" and add "Swallow.C" to
              your project
    Now nothing of Swallow is left and your debugger should work correctly.

Q:  I does the above step, but now my program should run in Protected Mode
    again, so I removed the option "NoSwallow" / "__NOSWALLOW", but I get
    linker errors / no Protected Mode!
A:  You have to recompile "Swallow.Pas" / "Swallow.C" to make change active.

Q:  Can I use Protected Mode TPU's or DLL's of Borland Pascal 7 with Turbo
    Pascal 7 and Swallow?
A:  Sorry, but this is not an DOS-Extender then a linker problem, and Turbo
    Pascal does not support DLL's or Protected Mode TPU's and so Swallow does
    not too.

