# basic-prot command

The basic-prot command toggles or displays
the status of the FlashBASIC object protection scheme.

**For Windows:**Is not required for FlashBASIC code.
Works the same as D3 UNIX for non-Flashed.

## Syntax

```
basic-prot {on|off}
```

## Parameter(s)

| on | Toggles object protection on. |
| --- | --- |
| off | Toggles object protection off. |
When enabled, this feature is global, thus it affects the
entire system.

D3 shares FlashBASIC object code between all
processes running a given program. While this vastly decreases memory
requirements, it also opens the possibility of one user compiling
a program while another user is concurrently running that same routine.
This circumstance tends to produce random, unexplainable aborts that
can be difficult to track on large systems. The protection scheme
involves insulating running object code from updates caused by recompilation.

When protection is enabled, all previous revisions of FlashBASIC
object code are kept in the same dictionary group, but are marked
as deleted. These deleted items are automatically cleared during the save process. This allows compiling programs while they
are currently being executed. Users running a given program when that
program is compiled continues to run the old version. If a user drops
out of the program, to TCL, for example, and re-executes the program,
the system executes the newest object version.

Old BASIC object
code is moved to the dm,object.queue, file where
it is eventually deleted. By default, object code remains in this
file until 1000 subsequent compiles (of any program) are performed.
To increase this number, use basic-prot *##* , where *##* is the new queue
size. To make the number infinite (or virtually infinite), use 0.
When this number of compiles is performed, a message is logged to
the errors file.

CAUTION: Enabling the object protection
scheme can require significant amounts of temporary overflow, as space
is required for every single update. This overflow space is returned
after a full save. The object protection mechanism is disabled during
the save because it must remove old revisions. The object protection
scheme is cleared when D3 is booted. To enable it each time the system
is rebooted, place the basic-prot-on command in
the user-coldstart macro. This command does *not* apply to FlashBASIC object code, which is implicitly shared
among all users and automatically protected against recompilation
of a program executed by other processes.

## See also

- [save command](https://d3codex.com/tcl/save-command/)
- [user-coldstart macro](https://d3codex.com/tcl/user-coldstart-macro/)

---
Source: https://d3codex.com/tcl/basic-prot-command/ - part of the D3Codex reference.
