Keil Logo

Alien (PL/M-51) Function

The C51 Compiler easily interfaces with the Intel PL/M-51 Compiler and allows you to:

  • Call PL/M-51 routines from C.
  • Call C routines from PL/M-51.

To invoke PL/M-51 routines from your C functions, you must first declare them external 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);

To create C functions that may be invoked from your PL/M-51 routines, you must 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 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, 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.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.