Building an application with PC*MILER|Connect is similar to using other DLLs from your C programs. You’ll need to specify in your project the directories that contain header and library files for PC*MILER|Connect. If you installed PC*MILER|Connect in C:\ALK Technologies, then the libraries will be in C:\ALK Technologies\PCMILERXX\Connect.
The headers and the sample code will be in C:\ALK Technologies\ PCMILERXX\Connect\C_CPP\StaticLink (header files are in the pcmsrv32 folder). Your application must include pcmsdefs.h and pcmstrip.h in all modules that use subroutines in PCMSRV32. You will need to include pcmsinit.h only in the files that start and stop the PC*MILER|Connect engine or use the engine’s error handling routines.
There is more than one way to call functions in the engine. You can either link the application with the supplied import library, or include the IMPORTS section from the included pcmsrv32.def file in your project’s module definition file.
- To link with the PC*MILER|Connect’s import library, add PCMSRV32.LIB to your project. The way you do this depends on the programming environment you use. From the Borland IDE, you insert PCMSRV32.LIB into your project from the project window.
- To add the imported functions to your module definition file, open your project’s DEF file and the file PCMSRV32.DEF, and copy the IMPORTS section from PCMSRV32.DEF to your project’s DEF file.
If desired, you can copy only those functions that you use in your project.
Your module definition file should now look something like this:
EXETYPE WINDOWS CODE PRELOAD MOVEABLE DISCARDABLE DATA PRELOAD MOVEABLE MULTIPLE HEAPSIZE 8192 STACKSIZE 16384 IMPORTS PCMSRV32.PCMSOPENSERVER PCMSRV32.PCMSCLOSESERVER PCMSRV32.PCMSNEWTRIP PCMSRV32.PCMSDELETETRIP PCMSRV32.PCMSCALCULATE PCMSRV32.PCMSADDSTOP
You can also use the LoadLibrary call at runtime to load PC*MILER|Connect, then call GetProcAddress to retrieve the entry points for the functions exported from the DLL. Examples of this method using Visual C++ 4.0 are included in the PC*MILER installation folder, usually C:\ALK Technologies\PCMILER31\Connect.