Compiling and Linking Your DLL |
To create your DLL, you need a 32-bit Microsoft compiler — Visual C++ 5.0, 6.0 or 7.0 (.NET) will all work. Instructions on compiling and linking your DLL are given in the README.TXT file in the USEREFI/microsft subdirectory, along with the outline given below. You can also build the samples with VCBuild.exe, a free, public domain tool from Microsoft. Go to http://www.gotdotnet.com/team/cplusplus/samples/vcbuild.zip to download it. The cl.exe (the C++ compiler) is still required to run VCBuild, so users who want to build with it have to get the Platform SDK from Microsoft, which contains the compiler, a linker, various libraries and documentation. The Platform SDK can be downloaded via Windows Update.
In the userefi/microsft/sources directory there is a Visual Studio solution called userefi.sln that includes all the projects for UserDLL examples. In each example directory there is a .vcproj file. You can open and build each project file separately or the solution as a whole in the Visual Studio 2003 IDE. In addition you can use the following command to build all of the examples from the command line:
"%MS_DEV%devenv.exe" userefi.sln /build debug
This builds the debug configuration of the whole solution, assuming that userefi.sln is in the current working directory.
To build a single project, use a command of the form:
"%MS_DEV%devenv.exe" userefi.sln /build release /project multiply
This builds the release configuration of the multiply.vcproj project.
Default paths for required libraries and header files are:
"c:\program files\mathsoft\mathcad 13\userefi\microsft\lib\MCADUSER.LIB""c:\program files\mathsoft\mathcad 13\userefi\microsft\include"To build your own projects from scratch, choose File > New > Project to create a Visual C++ Project.
Build the project, and copy the resulting .dll file from the Project directory to the /userefi subdirectory under your Mathcad installation. (You can configure Visual Studio to automatically copy the .dll to this directory.) To use your new function, restart Mathcad with the new .dll in place.
Specify mathcad.exe as the command line to launch when debugging the DLL project. Once Mathcad launches, you can call your compiled DLL function in Mathcad and use breakpoints in the code to debug.
If you are still having trouble getting a UserDLL to run (particularly if you are trying to execute someone else's code), you may wish to use the Microsoft Development analyzer tools, such as depends.exe, which lists any files (typically system DLLs) upon which your DLL depends.