Creating a User DLL

You can extend Mathcad's functionality by writing your own customized functions. Your functions will behave like Mathcad's built-in functions. A custom 32-bit DLL can have many of the same features as Mathcad built-in functions, such as customized error messages, interruption, and exception handling in case of overflow and divide by zero. Custom functions are allowed to pass complex scalars, complex matrices, and string variable types.

To create customized functions, you will need to:

  1. Create source code in C or C++ (or wrap FORTRAN code in a C wrapper).
  2. Compile the source code with a 32-bit compiler.
  3. Link the object files together with the Mathsoft-provided MCADUSER.LIB library to create a DLL.
  4. Place your DLL into the UserEFI subdirectory of the Mathcad install directory.
  5. Add an entry to Doc/Funcdoc/USER_EN.XML so that your function appears in the Insert Function dialog box.
  6. Modify the Doc/Help_XX/user/userHelp.htm file to create Help that will appear when you type the function and click F1.

The first four steps can all be done through the Visual Studio development environment. Instructions are provided for finding all the right resources, such as the MCADUSER.LIB library.

Terms of Use

DLL interface specifications contained in this Developer's Reference can be used for creating user-written external functions that work with Mathcad for your personal or internal business use only. These specifications may not be used for creating external functions for commercial resale without prior written consent from PTC.