Skip to content

native.aug ​

A native C boundary · Source and specification

Files in this project

Code ​

aug
// aug-spec: "native.aug.md" explains this file. Read it before changes; refresh with aug spec.
extern C puts(string message) returns c_int
announce():
    unsafe:
        puts(message="hello from C FFI")
aug
// aug-spec: "native.aug.md" explains this file. Read it before changes; refresh with aug spec.
extern C puts(string message) returns c_int
announce() {
    unsafe {
        puts(message="hello from C FFI")
    }
}

Compiled specification ​

Interactions and sequences

puts · source ​

It takes message as a string. It returns c_int. Native C implementation; only its declared contract is visible here.

announce · source ​

It can call C.puts. Within an unsafe block, it calls puts with message "hello from C FFI". Native operations must satisfy their declared C contracts. source

Checked interface
text
announce() returns void uses C.puts

It can call C.puts.

Last updated:

The world runs on language