Dummy function definitions

Create a local copy of the udefsforasm.h header file (./local_mod/base/include/tpf/udefsforasm.h) and add a dummy function definition in the header file for each C function that you create in BAL. You can copy the ./base/include/tpf/udefsforasm.h header file to create your local copy.

A dummy function definition is a definition that just returns to the caller. For example:
  • For a function that returns a void, code {return;}
  • For a function that returns a pointer, code {return NULL;}
  • For a function that returns a structure, return a dummy structure.
  • For a function that returns a boolean, code {return FALSE;}
  • For a function that returns an int or a long, code {return 0;}

With the dummy function definition, the compiler can generate function interface information that the z/TPF system uses later when formatting the ECB trace entry. These dummy function definitions are never called by any code.

If you have many C functions that are written in BAL, you might want to arrange your dummy function definitions in some kind of order so that it is easier to determine if a dummy function definition already exists for a function. For example, the cdefsforasm.c program, which is for IBM® use only, contains the function names in alphabetic order with a block comment for each letter.

A dummy function definition is not a function prototype. Table 1 provides examples of z/TPF function prototypes, the value that is returned, and the corresponding dummy function definitions.

Table 1. Dummy function definition examples
Function prototype Returns Dummy function definition
#define facs(r) FACS(r)
void FACS(struct TPF_regs *regs);
void void facs(struct TPF_regs *) {return;}
void *cinfc(enum t_cinfc type, int number, ...); pointer to void void *cinfc(enum t_cinfc type, int number, ...) {return NULL;}
struct cplkc_RC * call_cplkc(int,void *); pointer to structure struct cplkc_RC * call_cplkc(int i,void *ptr) {return NULL;}
struct mallinfo mallinfo (void); structure struct mallinfo mallinfo (void) {struct mallinfo mdummy; return mdummy;}
boolean bbld_recountNeeded ( ); boolean Boolean Bld_recountNeeded(void) {return FALSE;}
int waitc(void); integer int waitc(void) {return 0;}
long get_dump_tag_addr(int, char *); long long get_dump_tag_addr(int I, char *ptr) {return 0;}
The udefsforasm.h header file is included by the cdefsforasm.c program. This program, which is for IBM use only, also contains the dummy function definitions for z/TPF and z/TPFDF C functions that are coded in BAL. See program ./base/rt/cdefsforasm.c for more examples of dummy function definitions.
Note: Ensure that you place your dummy function definitions in a local copy of the udefsforasm.h header file and not in the cdefsforasm.c program.