README FILE FOR USING WATCOM C/C++32 COMPILER VERSION 11.0 TO BUILD A USER DLL FOR MATHCAD PROFESSIONAL Samples files are available in the SOURCES subdirectory. Each sample has a compile.bat and a link.bat file associated with it. To build a sample project just call these files in sequence. The instructions below assume that you have installed Mathcad in the directory C:\WINMCAD. If this is not true (for example, if you installed to the directory C:\PROGRAM FILES\MATHSOFT\MATHCAD), then please substitute the correct path wherever C:\WINMCAD appears. When using Watcom for the first time you should keep in mind the following points: * The compiler crashes if EMM386 memory manager is installed. So remove the memory manager from your config.sys or autoexec.bat file if you have it. * Make sure your include path includes watcom\h\nt;watcom\h;mstools\h where mstools\h contains the include files from Microsoft's Win32 SDK. (Watcom does not provide the Microsoft files.) * You must compile using stack-based argument passing conventions. This is done by using the compiler directive /3s or /4s depending on whether you have a 386 or 486 processor. * If you are running Watcom under DOS you must set the PATH environment variable so that it includes watcom\bin;watcom\binb. If your are running under NT, you must set the user environment variables so that the path includes watcom\binnt;watcom\binb. * The DLL entry point function must be called LibMain. * The default structure alignment is 1 byte. You must set it to 8 by the directive /zp8. * We have not provided an import library for MCADUSER.DLL because we had problems generating NT import libraries using the Watcom librarian WLINK. Therefore, the functions in MCADUSER.DLL are demand-loaded. Because of this, the include file and the sources for Watcom are significantly different from the others. For more information see the sample source files and the README.TXT file in the USEREFI subdirectory. Typical command lines: A typical compile line command for Watcom is: wcc386 /bd /3s /bt=nt /zp8 /i=c:\winmcad\userefi\watcom\include filename.c or, in relative notation for the samples, wcc386 /bd /3s /bt=nt /zp8 /i=..\..\include filename.c /bd is for building a DLL; /3s specifies the stack-based calling convention using 386 instructions; /bt=nt indicates we are building a 32-bit DLL; /zp8 causes 8-byte alignment of noncharacter members within structures; /i= indicates the path where the include files might be (in this case path for MCADINCL.H for Watcom); and filename is the name of the file being compiled. A typical link line command for Watcom is: wlink system nt_dll initinstance terminstance file {file1.obj file2.obj} name c:\winmcad\userefi\DLLname.dll or, in relative notation for the samples, wlink system nt_dll initinstance terminstance file {file1.obj file2.obj} name ..\..\..\DLLname.dll system nt_dll indicates we are building a 32-bit DLL; initinstance and terminstance are needed if you link with any runtime libraries; file1 and file2 are the names of the object files to be linked; DLLname is the name of the DLL to be built (this is optional and if it is not present the compiler will use the name of the first object file for DLLname).