Browse Prior Art Database

Procedure Call Linkage Method

IP.com Disclosure Number: IPCOM000115956D
Original Publication Date: 1995-Jul-01
Included in the Prior Art Database: 2005-Mar-30
Document File: 2 page(s) / 71K

Publishing Venue

IBM

Related People

Bealkowski, R: AUTHOR [+3]

Abstract

A procedure call linkage method is disclosed. The method allows for separately built software such as firmware, diagnostics and utilities to call and export non-local procedures. The traditional calling syntax is preserved.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Procedure Call Linkage Method

      A procedure call linkage method is disclosed.  The method
allows for separately built software such as firmware, diagnostics
and utilities to call and export non-local procedures.  The
traditional calling syntax is preserved.

      The first step is to create a macro language file which defines
the procedures to be included in the Application Programming
Interface (API).  The following example illustrates the macro
language file (fw_api.m4) content.  The macro is used to parse the
subsequent "fw_call" statements.
  /* Macro */
       define('fw_call', 'divert(1)dnl
       '  /* Index ' Index 'assigned to */ ' $2,
       divert(2)dnl
       '  /* Index ' Index 'assigned to */ &'$2_ptr','
       divert(3)dnl
       $1 (*$2_ptr) $3;
       divert(4)dnl
       #ifdef $2
       #undef $2
       #endif
       'extern' $1 (*$2_ptr) $3;
       '#define' $2 (*$2_ptr)
  /* Procedure Entries */
       fw_call(int,         abs,                 (int))
       fw_call(int,         atoi,                (const char *))
         ...
         ...
       fw_call(int,         printf,              (const char *, ...))

      The next step is to use the AIX m4 Macro Processor to process
the macro file fw_api.m4  into a C-style header file fw_api.h.
Typically, declarations are defined to a C compiler through header
files.  The library function printf() will be used throughout as an
example but any function can be used with this method.  For example,
including "stdio.h" defines printf() to the compiler.  If the call
is not a local reference, then the compiler creates a placeholder
"call" to the routine which is filled in when the linkage editor
combines all the code and libraries.

      The next step is to compile program code with the include
file fw_api.h.  When used in source code to define procedure calls
the
include file fw_api.h modifies the description of printf():
  #ifdef printf
  #undef printf
  #endif
  extern int (*printf_ptr) (const char *, ...);
  #define printf (*printf_ptr)

This deletes the compiler's knowledge...