README FILE FOR USING MICROSOFT COMPILERS (WIN32 SDK, VISUAL C++ [32S
VERSION], VISUAL C++ FOR NT, VISUAL C++ FOR WINDOWS 95) TO BUILD A
USER DLL FOR MATHCAD 7 PROFESSIONAL

The instructions assume that you have installed Mathcad in the directory
C:\WINMCAD. If this is not true (for example, if you accepted the default 
Mathcad 7 Professional installation directory C:\PROGRAM FILES\MATHSOFT\MATHCAD),
then please substitute the correct path wherever C:\WINMCAD appears.

1. Using the Command Line

Sample files are provided in the SOURCES subdirectory. Each sample 
has a compile.bat and a linkme.bat file associated with 
it. To build a sample project just call these files in sequence.

For information on how to generate new source files, see Appendix F 
in the User's Guide.

Using command line calls to the compiler and linker:

Typical compile line:

  cl -c -IC:\WINMCAD\USEREFI\MICROSFT\INCLUDE -DWIN32 
filename.c

or, using the relative notation in the case of the samples,

  cl -c -I..\..\INCLUDE -DWIN32 filename.c

Typical link line:

  link -out:C:\WINMCAD\USEREFI\DLLname.dll -dll 
  -entry:"DllEntryPoint"  
  filename.obj
  C:\WINMCAD\USEREFI\MICROSFT\LIB\MCADUSER.LIB

or, again, using the relative notation in the case of the samples,

  link -out:..\..\..\DLLname.dll -dll -entry:"DllEntryPoint" filename.obj 
..\..\LIB\MCADUSER.LIB

2. Using Visual C++

Each sample has a .mak project file associated with it. To build a 
sample just start Visual C++, open the project and Rebuild it.

To generate a new user DLL project in Visual C++:

        * Create a new project and choose a name and path for it. 
        * Choose Dynamic Link Library (.DLL) for the Project Type. 
        * Add your source files to the project. (If you 
          have not created the source files yet you can add them later.)
        * Add the library file MCADUSER.LIB in the MICROSFT\LIB 
          directory to the project.
        * In the Options/Project Compiler Options dialog box choose 
          the Preprocessor category and add the directory where 
          the include file MCADINCL.H for MICROSFT is located, e.g. 
          C:\WINMCAD\USEREFI\MICROSFT\INCLUDE (or ..\..\INCLUDE 
          in relative notation for the samples) to the Include path.
        * In the Options/Project Linker Options dialog box choose 
          the Image Attributes category and enter DllEntryPoint 
          for the Entry-Point Symbol.

Now you are ready to build the DLL. You can do this by choosing 
Rebuild All on the Project menu.
  
After building you have to move the DLL to the USEREFI directory 
under MATHCAD's default directory, e.g. C:\WINMCAD\USEREFI. 

Comments:
        
        * In the source file, the DLL entry point can be called 
          anything you want, e.g., DllEntryPoint. However, you need 
          to specify the name to the linker. You do this by 
          choosing a linker option as described above.

        * You must initialize C runtime libraries using 
          calls to _CRT_INIT when the DLL is first entered and when 
          it is detached. This is demonstrated in the sample.

        * Alignment: The default structure alignment for Win32s 
          applications is 8-byte alignment.

For more information see the sample source files and the README.TXT 
file in the USEREFI subdirectory.
