ZEMAX has powerful abilities to let you write your own user-defined surfaces, objects, scattering functions, diffraction functions etc as a compiled function -known as a dll- and to link it into ZEMAX. Such user-defined functions work just like built-in functions. ZEMAX is supplied with many examples written in C.

In this note, I’ll show some specific techniques which were successful in getting ZEMAX to accept user-defined objects written in the Lahey/Fujitsu Fortran 95 Compiler. None of these UDOs have been widely tested in an exhaustive variety of platforms, so there may yet be bugs that haven’t been found – nevertheless, they have proven useful, and may be so to others. (I’d appreciate feedback and/or bugs reports to casey@rockfieldresearch.com).

The Lahey/Fujitsu Compiler is a popular and powerful Fortran compiler, with full 32 bit flat memory and many structured enhancements that allow easy mixing of old legacy code with more readable functionality. For those beyond a certain age, Fortran remains an easier language to think and generate code in. This article is aimed at  those people. The examples were compiled with Lahey/Fujitsu release 7.10.02.  All of these user-defined functions were written for non-sequential optics applications.