A unit's initialization section only runs when that unit is compiled into the program's own translation unit; units linked from a prebuilt archive never get their _init called. blaise_weak relies on its initialization section to set up the weak-reference table mutex, so for archive builds that setup never happened. A zero-filled mutex object is a valid unlocked mutex on some platforms, which kept this latent — but that is not guaranteed everywhere. Add a _BlaiseInit RTL entry point that performs the one-time setup (currently the weak-table mutex, guarded to stay idempotent) and have each backend's $main emit a call to it right after _SetArgs, before any user code runs. The mutex is now initialised explicitly instead of by relying on a zero-filled object happening to be valid. Regression: cp.test.codegen TestMain_CallsBlaiseInit asserts the call. |
||
|---|---|---|
| .. | ||
| src | ||
| Makefile | ||
| project.xml | ||