變數¶ C 函式庫公開的變數可以使用類似全域變數的宣告方式,在 lib 宣告中宣告 lib C $errno : Int32 end 然後就可以取得和設定它們 C.errno # => some value C.errno = 0 C.errno # => 0 變數可以使用註解標記為執行緒區域變數 lib C @[ThreadLocal] $errno : Int32 end 請參閱型別文法以了解外部變數型別中使用的標記法。