Custom Functions > To Compile the userpack Sample Extension
To Compile the userpack Sample Extension
1. Open a Visual Studio Command Prompt.
2. Navigate to the PTC Mathcad Prime installation folder.
3. At the prompt, enter the following commands to navigate to the userpack folder and view its content:
Command
Description
cd Custom Functions/userpack
Changes the directory to the userpack folder.
dir
Lists the files in the current folder.
Ensure that REALSUM.C, TRNSPOSE.C and USERPACK.C are listed.
4. Ensure the presence of the include and library files in the Custom Functions folder:
Command
Description
dir ..
Lists the files in the Custom Functions folder.
Ensure that MCADINCL.H and mcaduser.lib are listed.
5. To compile and link the userpack functions, enter the following commands:
Command
Description
cl /I../ *.C /LD /link /out:../userpack.dll /entry:"DllEntryPoint" ../MCADUSER.LIB
Generates the userpack.dll file in the Custom Functions folder.
Additional Information
The sample extension sub-folder userpack contains three .C source files, and the compilation and linking process produces the userpack.dll file.
REALSUM.C shows that FUNCTIONINFO is defined as realsum and accepts two real arguments (a,b).
TRNSPOSE.C shows that FUNCTIONINFO is defined as transpose and accepts one matrix argument (X).
USERPACK.C shows that FUNCTIONINFO is defined as realsum and transpose. This means that USERPACK.C does not represent a function but a wrapper for the two functions realsum and transpose.
Function names realsum and transpose are not part of the produced userpack.dll file name. To use these two custom functions in your worksheet, close and reopen PTC Mathcad Prime and then evaluate realsum(a,b) or transpose(X).
Was this helpful?