Chapter 2 - using the api, Introduction, Getting started – Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual

Page 17: Programming conventions, Chapter 2, Using the api, Chapter

Advertising
background image

Publication 1747-6.5.3 June 1998

Chapter

2

Using the API

Introduction

This chapter describes the API and how to use its components. For more information
about developing applications using the API, see chapter 3.

Getting Started

To use the API, make sure you have copied the following files to your development
directories. The sample files are optional.

Your application must link to the appropriate library (

ocapil.lib

for DOS or

ocapi.lib

for Windows NT) and include

ocapi.h

. You can copy the sample files

and adapt them for your application.

Programming
Conventions

The API is supplied as an object code library file (

ocapil.lib

) or a DLL

(

ocapi.dll

) that you link with the host application’s object code using

commercially-available tools.

This file:

Contains:

ocapil.lib

API functions that you link to your application (DOS only)

ocapi.lib

Import library in Microsoft COFF format (Windows NT only)

ocapi.h

API header file that contains API-referenced structures

ocapi.dll

API DLL (Windows NT only)

sample.c

Sample application program calling the API functions

sampleb.mak

Sample MAKE file for the Borland C compiler

samplem.mak

Sample MAKE file for the Microsoft C compiler

This convention:

Considerations:

calling convention

The DOS API functions are specified using the C programming language syntax. To allow you to
develop control applications in other programming languages, the API functions use the standard
Pascal calling convention.

The Windows NT API supports any programming languages that use the Win32 _stdcall calling
convention for application interface functions. The Windows NT API function names are exported
from the DLL in undecorated format to simplify access from other programming languages.

header files

The API includes a header file (

ocapi.h

) that contains API function declarations, data structure

definitions, and other constant definitions. The header file is in standard C format.

sample code

The API comes with sample files to provide an example application that communicates with the
scanner. The sample files include all source files and MAKE files required to build the sample
application.

compiler support

The DOS API is supplied in the large memory model, compatible with both Microsoft and Borland
compilers. The DOS library (

ocapil.lib

) is compiled as a 16-bit MS-DOS library using the

80386 instruction set.

The Windows NT library (

ocapi.dll

) is compiled for use with Microsoft Visual C++ or

Borland C++.

Advertising
This manual is related to the following products: