Header-to-copy ユーティリティが C ソース コード内のパラメーター受け渡し規約を等価な COBOL COPY ファイル形式に翻訳する例を次に示します。
C のソース
typedef int (_far _pascal* FARPROC)(); typedef struct tagSEGINFO { UINT offSegment; UINT cbSegment; UINT flags; UINT cbAlloc; HGLOBAL h; UINT alignShift; UINT reserved[2]; } SEGINFO; typedef SEGINFO _far* LPSEGINFO; typedef struct tagPOINT { int x; int y; } POINT; void _far _pascal GetCodeInfo(FARPROC lpProc, SEGINFO _far* <_><_>lpSegInfo); BOOL _far _pascal PtInRect(const RECT _far*, POINT); void _far _pascal ClientToScreen(HWND, POINT _far*);
生成される COBOL コード
01 FARPROC is typedef usage proc-pointer. 01 tagSEGINFO is typedef. 02 offsegment usage uns-int. 02 cbsegment usage uns-int. 02 flags usage uns-int. 02 cballoc usage uns-int. 02 h usage uns-int. 02 alignshift usage uns-int. 02 reserved occurs 2 usage uns-int. 01 SEGINFO is typedef usage tagseginfo. 01 LPSEGINFO is typedef usage data-pointer. 01 tagPOINT is typedef. 02 x usage int. 02 y usage int. 01 POINT is typedef usage tagpoint. end program "c-typedefs". program-id."c-typedefs" is external. special-names. call-convention pascal-convention-val is pascal-conv. $set constant GetCodeInfo "GetCodeInfo" entry GetCodeInfo pascal-conv using by value proc-pointer by reference seginfo . $set constant PtInRect "PtInRect" entry PtInRect pascal-conv using by reference rect by value point returning int . $set constant ClientToScreen "ClientToScreen" entry ClientToScreen pascal-conv using by value uns-int by reference point . end program "c-typedefs".
POINT 型のパラメーターは、BY VALUE と BY REFERENCE の両方で渡されます。