DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page
B3007: imported subprogram without a Global contract
Catalog status: active. Default severity: error. Stable name: import-without-global. Family: Flow and effects.
Verada cannot see inside a subprogram imported from C, so its Global contract is required and trusted: it is the only description of what the call reads and writes.
Example (Vada)
function Ticks return Integer
with Import, Convention => C, External_Name => "clock"; -- no GlobalExample (Varc)
pub fn ticks() -> Integer
@Import @Convention(C) @External_Name("clock"); // no Global
What to do (Vada)
Add Global => null when the foreign code uses no Verada state, or list what it reads and writes.
What to do (Varc)
Add @Global(null) when the foreign code uses no Verada state, or list what it reads and writes.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See flow and effects, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.