Alien Functions

C51 allows you to call routines written in PL/M-51 from your C programs. You can access PL/M-51 routines from C by declaring them external along with the alien function type specifier. For example:
extern alien char plm_func (int, char);

char c_func (void)
{
int i;
char c;

for (i = 0; i < 100; i++)
{
c = plm_func (i, c); /* call PL/M func */
}

return (c);
}
You may also create functions in C that can be invoked by PL/M-51 routines. To do this, use the alien function type specifier in the C function declaration. For example:
alien char c_func (
char a,
int b)
{
return (a * b);
}

Parameters and return values of PL/M-51 functions may be any of the following types: bit, char, unsigned char, int, and unsigned int. Other types, including long, float, and all types of pointers, can be declared in C functions with the alien type specifier.  However, you should use these types with care because PL/M-51 does not directly support 32-bit binary integers or floating-point numbers.

Public variables declared in the PL/M-51 module are available to your C programs by declaring them external like you would for any C variable.