gawk: Loading Shared Libraries

1 
1 2.8 Loading Dynamic Extensions into Your Program
1 ================================================
1 
1 This minor node describes a feature that is specific to 'gawk'.
1 
1    The '@load' keyword can be used to read external 'awk' extensions
1 (stored as system shared libraries).  This allows you to link in
1 compiled code that may offer superior performance and/or give you access
1 to extended capabilities not supported by the 'awk' language.  The
1 'AWKLIBPATH' variable is used to search for the extension.  Using
1 '@load' is completely equivalent to using the '-l' command-line option.
1 
1    If the extension is not initially found in 'AWKLIBPATH', another
1 search is conducted after appending the platform's default shared
1 library suffix to the file name.  For example, on GNU/Linux systems, the
1 suffix '.so' is used:
1 
1      $ gawk '@load "ordchr"; BEGIN {print chr(65)}'
1      -| A
1 
1 This is equivalent to the following example:
1 
1      $ gawk -lordchr 'BEGIN {print chr(65)}'
1      -| A
1 
1 For command-line usage, the '-l' option is more convenient, but '@load'
1 is useful for embedding inside an 'awk' source file that requires access
1 to an extension.
1 
1    ⇒Dynamic Extensions, describes how to write extensions (in C
1 or C++) that can be loaded with either '@load' or the '-l' option.  It
1 also describes the 'ordchr' extension.
1