blob: 5394d7897da338c39740fe67b1d28e73de0e348a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# Multi-file builds and the standard library
Part of the [pitfalls index](../PITFALLS.md).
- **Multi-file extensions.** INCLUDE imports symbols, never text; every included file
must also be an input.
- Duplicate exports across files fail even without visibility, except distinct
signatures whose definitions all specify OVERLOAD.
- Only one file may contain top-level code; top-level DECLARE is a main local, not
an export.
- Definitions-only builds fail without FUNCTION MAIN returning INTEGER. MAIN
cannot coexist with top-level code.
- GLOBAL accepts only the five primitive scalar types and literal initializers;
arrays, user types and computed initializers are rejected.
- Own top-level constants remain positional, imported constants do not.
- **Default standard library.** std.cps and its imported STRING and memory libraries are embedded
and automatically linked.
- Use -no-std before explicitly supplying a replacement STRING class/library;
otherwise duplicate definitions fail.
- Ordinary literals require a visible STRING class with NEW(C_STRING).
- C_TYPE/INCLUDE/EXTERN syntax strings are parser metadata and do not construct
STRING.
- Keyword NEW/DELETE and MALLOC/REALLOC/FREE require memory.cps; -no-std users
must explicitly import it. Ordinary constructor/destructor methods still work
without it.
- -S emits IR only; default-library manual linking needs string.o, memory.o and
the C++ runtime.
|