If you wish to run Mechanical APDL with user customizations, the preferred method is to design and program your custom routine in Fortran. Although you can use languages other than Fortran, in each case Fortran must provide the interface to the rest of the Mechanical APDL program. If you do use a language other than Fortran, such as the C or C++, your code may require a Fortran shell.
You need to take care when calling Fortran subroutines from C or C++ subroutines. You must use the symbol associated with the Fortran subroutine when invoking the subroutine from a C or C++ function. This symbol typically differs slightly from the Fortran subroutine name, and is extremely system dependent.
On many Linux systems, you build this symbol name by taking the Fortran subroutine name, converting it to lower case, and appending an underscore. For example, the symbol name for the Fortran subroutine HeapInquire would be heapinquire_. You would have to use the symbol heapinquire_ in the invoking C function to avoid an unsatisfied external reference when the program is linked.
Keep in mind that the instance described above is just an example. Compilers from different vendors may construct the symbols differently. Consult the manuals for your specific compiler for information on how to call Fortran subroutines from C or C++ functions.
For more information on Fortran compilers, refer to the installation guide specific to your operating system (Ansys, Inc. Linux Installation Guide or Ansys, Inc. Windows Installation Guide).
Using Python
As an alternative to compiled languages like C and Fortran, you can use the Python language to code user-programmable subroutines. You must install a Python distribution before using this feature. A subset of the documented UPF subroutines support the Python UPF capability. For more information, see Using Python to Code UPF Subroutines.