Few large development projects contain only one programming language. Frequently, in large projects two or more languages need to interact via calls, passing data from programs in one language to another. The problem is that if an interface is defined in two files, in each language, they will inevitably disagree causing hours, if not days of extra test & debug work. If, however you combine the interface definitions into one file, it becomes easier to keep the two language interface definitions synchronized.
If you have examined the z/OS SYS1.MACLIB, you have likely observed many macros that contain both Assembler and PL/X interface definitions. I have also used a similar technique with PL/1 and Assembler.
For example, I’ve worked on large projects that interfaced IBM XLC with IBM High Level Assembler. Here is how we were able to define interface files containing both Assembler DSECTs and C typedefs and structures interspersed. The key is to arrange for the assembler statements to be ignored by the C compiler, and the C statements to be ignored by the assembler.
First, define two assembler macros: “#ifndef” and “#endif”. They both should expand into assembler comment lines. Next, code the file as shown in this simple example:
#ifndef __PARMLIST__
#ifndef __TIMESTAMP__
* The __TIMESTAMP__ C preprocessor macro is always defined.
* The assembler interface definition follows:
PARMLIST DSECT
PARMONE DS AD * 64BIT ADDRESS OF FIRST PARAMETER
PARMTWO DS AD * 64BIT ADDRESS OF SECOND PARAMETER
PARMLIST_LENGTH EQU *-PARMLIST
#endif /* the IBM XLC interface definition follows:
*/ #define __PARMLIST__ /*
*/ typedef struct PARMLIST { /*
*/ char * parmOne; /*
*/ char * parmTwo; /*
*/ } parmlist_t, *parmlist_p;
#endifAbout H&W




