Microsoft KB Archive/32487

Language Prefixes and Mixed-Language CALLs

PSS ID Number: Q32487 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

Summary: Language prefixes can be used to avoid reversing parameters in the CALLed and CALLing programs, as in the following example: “L_function” - Lattice C “C_function” - Microsoft C “P_function” - Microsoft Pascal “F_function” - Microsoft FORTRAN “function” - 8086 Assembler

More Information: A COBOL program that calls a C routine called “CSTUFF” would contain the following call: CALL C_testfile Please note that although the parameter lists will be in the same order, the “F_function” and “P_function” prefixes reverse the order of parameters in the stack, in addition to specifying the return code register usage for four-byte return codes. This is useful for keeping the calling and the called arguments in the same order. Also note that the LITLINK compile directive, the use of a language prefix, or the use of SMALLDD forces static linking. Once any of these is used, the called routines must be static linked. When a C program calls a COBOL program, you must use the PROGRAM-ID in COBOL to force an underscore on the main entry point, as in the following example: C code: MAIN { FRED; } COBOL code: IDENTIFICATION DIVISION. PROGRAM-ID. _FRED.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.