Browse Prior Art Database

A Generic Way To Call A C/C++ function From Assembler Language Code

IP.com Disclosure Number: IPCOM000028145D
Original Publication Date: 2004-Apr-28
Included in the Prior Art Database: 2004-Apr-28
Document File: 2 page(s) / 66K

Publishing Venue

IBM

Abstract

Disclosed is a method to generate assembler language code to call a C/C++ function from an assembler language program independent of the machine architecture, compiler, and operating system associated with the code.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 2

A Generic Way To Call A C/C++ function From Assembler Language Code

Disclosed is a method to generate assembler language code to call a C/C++ function from an assembler language program. This invention enables assembler language programs to call C/C++ language functions independent of the machine architecture, compiler, and operating system associated with the code.

    Two assembler language macros are used to simulate the C/C++ language code needed to call a C/C++ function. The CPROC assembler macro simulates the coding of a function prototype in C/C++ language code. The CALLC assembler macro simulates the actual function call in C/C++ language code. If an assembler program uses the CALLC macro to call a C/C++ function, the program must issue a CPROC macro to define the function prototype for that function. The CALLC macro simulates the code generated by the C/C++ compiler by passing the parameters to the function in the format expected by the function.

    The CPROC macro consists of three required parameters: (1) the C/C++ language type of the return value; (2) the name of the function to be called; (3) a list of C/C++ language types for each of the arguments that are passed as parameters to the C/C++ function. Examples of C/C++ language types that are supported by the CPROC macro are: unsigned character, unsigned short integer, unsigned integer, signed integer, unsigned long integer, and pointer. The CALLC macro, when coded in assembler language, looks very similar to a C/C++ language function call. The macro specifies the function name followed immediately by a set of arguments enclosed in parenthes...