The API package that you receive includes a sample application that demonstrates the API function calls in context. Install the sample application and review the source code to understand how you can use the function calls. Select one of two sample application packages: the interactive, single-threaded application package (dapi*), or the multi-threaded application package (callmt*).
When you build the sample application, the procedure to follow depends on the platform on which you run.
Note: | For Windows NT applications that were built with the Version 2 API, replace the current adsm32.dll with the adsm32.dll and adsmv3.dll. For Windows NT applications that were built with the Version 3.1 API, replace the adsmv3.dll with the adsmv3.dll and tsmapi.dll. For new applications, build with, and use the tsmapi.dll. |
We recommend that you use dynamic loading. See
dynaload.c and implementation in the sample code. For
Windows NT and Windows 98 platforms, the files listed in Table 4 comprise the source files that you need to build the sample
application. This sample application is included in the API
package.
Table 4. Files Needed to Build the Windows NT, 98, and 2000 API Sample Application
File Names |
| Description |
---|---|---|
api.txt |
| Readme file |
dapismp |
| API sample program |
blkhook.def blkhook.c blkhook.mak |
|
Definition file for blocking hook single-threaded DLL Sample source code for blocking function Makefile |
tsmapi.dll adsmv3.dll adsm32.dll blkhook.dll |
| API DLLs |
dsmrc.h dsmapitd.h dsmapips.h dsmapifp.h dsmapidl.h release.h |
|
Return codes header file Common type definitions header file Operating system-specific type definitions header file Function prototype header file Dynamically loaded function prototype header file Release values header file |
dapidata.h dapint64.h dapitype.h dapiutil.h |
| Source code header files |
dsmapi.lib |
|
Implicit library |
dapibkup.c dapiinit.c dapint64.c dapipref.c dapiproc.c dapiproc.h |
dapipw.c dapiqry.c dapirc.c dapismp.c dapiutil.c dynaload.c | Source code files for dapismp.exe |
dapismp.mak |
|
Visual C++ makefile for API sample program |
callmt1.c callmt2.c makemt.mak |
|
Multi-threaded sample files Multi-threaded sample files Makefiles to build multi-threaded samples for your platform. |
In addition, the API\OBJ directory contains the API sample program object files, the API\SAMPRUN directory contains the sample program, and the dapismp sample program contains the execution directory.
The source code (blkhook.c) and makefile (blkhook.mak) for a blocking function are included along with the sample API program, dapismp, for applications using non-threaded graphical user interfaces (GUI) that must switch out from their message loops when blocked. The DLLs (tsmapi.dll, adsm32.dll, blkhook.dll, and adsmv3.dll) are all 32-bit DLLs.
Use the Microsoft Visual C++ Level 6.0 compiler and the makefile, dapismp.mak, to compile the API sample application, dapismp. It might be necessary to adjust the makefiles (specifically, the library or the Include directories) to fit your environment. To run the sample application, enter dapismp from the api\samprun directory.
The files listed in Table 5 comprise the source files and other files that you need to
build the sample application that is included with the API package.
Table 5. Files Available for Building the UNIX API Sample Application
File Names |
| Description |
---|---|---|
readme.api |
| Readme file |
dsmrc.h dsmapitd.h dsmapips.h
|
|
Return codes header file Common type definitions header file Operating system-specific type definitions header file Function prototype header file Release values header file |
dapibkup.c dapidata.h dapiinit.c dapint64.h dapint64.c dapipref.c dapiproc.c dapiproc.h |
dapipw.c dapiqry.c dapirc.c dapismp.c dapitype.h dapiutil.h dapiutil.c | Modules for the command line-driven sample application |
makeapi.xxx |
| Makefile to build dapismp for your platform. The xxx indicates the platform. |
caller1.c caller2.c |
| Simple example modules |
callmt1.c callmt2.c |
| Multi-threaded sample files |
libApiDS.xx |
| Shared library (the suffix is platform-dependent) |
For specific install and build instructions, see the README.API for your platform and follow these steps:
The files listed in Table 6 comprise the source files and other files that you need to
build the sample application that is included with the API package.
Table 6. Files Available for Building the Novell NetWare API Sample Application
File Names |
| Description |
---|---|---|
readme.api |
| Readme file |
dsmapifp.h dsmapitd.h dsmapips.h
|
|
Function prototype header file Common type definitions header file Operating system-specific type definitions header file Return codes header file Release values header file |
dsmapi.nlm |
| API loadable module |
dapibkup.c dapidata.h dapiinit.c dapipref.c dapiproc.c dapiproc.h dapipw.c dapiqry.c dapirc.c |
dapismp.c dapismp.lnk dapismp.wat dapismp.nlm dapitype.h dapinwut.c dapiutil.c dapiutil.h | Source code files for a sample application that demonstrates the use of the major API functions |
callmt1.c callmt2.c callmt1.wat callmt2.wat |
|
Multi-threaded sample files
|
Follow these steps to compile the sample application and test the installation:
wmake /f dapismp.wat
Compiler messages display until the compile completes.
Note: | You must have the following files on your NetWare server before you run the
sample application, dapismp.nlm:
|
search add sys:\adsm\api
load dapismp
The files listed in Table 7 comprise the source files and other files that you need to
build the sample application that is included with the API package.
Table 7. Files Available for Building the AS/400 API Sample Application
File Names |
| Description |
---|---|---|
CRTAPISMP |
| Source for a CL program to create the sample application |
dsmrc.h dsmapitd.h dsmapips.h
|
|
Return codes header file Common type definitions header file Operating system-specific type definitions header file Function prototype header file |
dapibkup.c dapidata.h dapiinit.c dapint64.h dapint64.c dapipref.c dapiproc.c dapiproc.h |
dapipw.c dapiqry.c dapirc.c dapismp.c dapitype.h dapiutil.h dapiutil.c | Source code files for a sample application that demonstrates the use of the primary API functions |
The .c files are members of the file, QANSAPI/QCSRC, and the .h files are members of the file, QANSAPI/H. The CL source is contained in the file, QANSAPI/QCLSRC.
Follow these steps to compile the sample application and test the installation:
CRTCLPGM PGM(QANSAPI/CRTAPISMP) SRCFILE(QANSAPI/QCLSRC)
CRTCMOD MODULE(QANSAPI/DAPISMP) SRCFILE(QANSAPI/QCSRC) OUTPUT(*PRINT)
CALL CRTAPISMP ( target_library QANSAPI )
call dapismp
Before you run the sample application, perform the following:
After you enter dapismp to start the sample application, follow the instructions that display on your screen. When you run the application, perform the following: