GT.Mでは、C言語ルーチンの呼び出しは、次の構文で行うことができます。
DO &[packagename.]name[^name][parameter-list]
または式の要素として、
$&[packagename.]name[^name][parameter-list]
ここで、パッケージ名(packagename)は、名前の要素と同様に、有効なMの命名規則の名前です。Because of the parsing conventions of M, the identifier between the ampersand (&) and the optional parameter-list has precisely constrained punctuation - a later section describes how to transform this into a more richly punctuated name should that be appropriate for the called function. While the intent of the syntax is to permit the name^name to match an M labelref, there is no semantic implication to any use of the up-arrow (^). For more information on M names, labelrefs and parameter-lists, refer toChapter 5: “General Language Features of M”.
例:
; 外部ルーチンをコール DO &rtn1 ;Call int^exp in package "mathpak" with one parameter: the expression val/2 DO &mathpak.int^exp(val/2) ;Call the routine sqrt with the value "2" WRITE $&sqrt(2) ;Call the routine get parms, with the parameter "INPUT" and the variable "inval", passed by reference. DO &getparms("INPUT",.inval) ;Call program increment in package "mathpak" without specifying a value for the first argument and the variable "outval" passed by reference as the second argument. All arguments which do not specify a value translate to default values in the increment program. Do &mathpak.increment(,.outval)
呼び出されたルーチンは、Cの呼び出し規則に従ってください。それらは、位置的に独立しているコードとしてコンパイルされ、共有ライブラリとしてリンクする必要があります。