User`s manual
CYDAS UDR Library User’s Guide CYDAS UDR Library Description and Use
7
Error handling
Most library functions return an error code. If no errors occurred during a library call, 0 (or NOERRORS) is
returned as the error code. Otherwise, it is set to one of the codes listed in the CYDAS UDR Library Function
Reference "Error Codes" chapter. This document is available on our website, on this software CD, and
C:\MCC\Documents (by default) after software is installed.
If a non-zero error code is returned, you can use
cbGetErrMsg() to convert the error code to a specific error
message. As an alternative to checking the error code after each function call, you can turn on the library's
internal error handling with
cbErrHandling().
16-bit values using a signed integer data type
When using functions that require 16-bit values, the data is normally in the range of 0 to 65535. However,
some programming languages, such as BASIC and Visual Basic only provide signed data types. When using
signed integers, reading values above (32767) can be confusing.
The number (32767) in decimal is equivalent to (
0111 1111 1111 1111) binary. The next increment (1000
0000 0000 0000) binary has a decimal value of (-32768). The maximum value (1111 1111 1111 1111)
binary translates to (-1) decimal. Keep this in mind if you are using Basic, Visual Basic (up to version 6) or
other languages that don’t support unsigned integers.
There is additional information on this topic in the CYDAS UDR Library Function Reference. This document
is available on our website, on this software CD, and C:\MCC\Documents (by default) after software is
installed. Also, refer to the documentation supplied with your language compiler.
Using the CYDAS UDR Library in Windows
All 32-bit applications (including console applications) access the 32-bit Windows Dynamic Link Library
(DLL) version of the CYDAS UDR Library (CBW32.DLL). Example programs are provided for MS Visual
C++, MS Visual Basic, Borland C++, and Borland Delphi in the Sample32 subdirectories of the installation
directory. These sample programs illustrate the use of CBW32.DLL.
For 16-bit Windows applications, or Windows applications running in Windows 3.x, the 16-bit Windows
DLL version of the CYDAS UDR Library (CBW.DLL) should be used. Example programs are provided for
Visual Basic and both Borland and MS C in the Sample16 subdirectories of the installation directory. These
programs illustrate the use of CBW.DLL.
Due to the differences in memory management among DOS, Windows 3.x, and 32-bit Windows
(95/98/ME/NT/2000/XP), the scan functions have slightly different argument lists. In DOS libraries, all scan
functions take a pointer to a data array as one of their arguments. In Windows 3.x, these functions take a
handle to a Windows Global Memory buffer instead of a pointer to an array. In the 32-bit Windows version,
these functions take a pointer (a 32-bit virtual address) or a handle returned from
cbWinBufAlloc().
The affected functions are:
cbAInScan()
cbAOutScan()
cbAPretrig()
cbDInScan()
cbDOutScan()
cbStoreOnInt()