SAS Companion for the OS/2 Environment |
Dynamic link libraries (DLLs) are executable files that contain
one or more routines written in any of several programming languages. DLLs
are a mechanism for storing useful routines that might be needed by many applications.
When an application needs a routine that resides in a DLL, it loads the DLL,
invokes the routine, and unloads the DLL upon completion. The SAS System under
OS/2 provides routines and functions that let you invoke these external routines
from within the SAS System. You can access the DLL routines from the DATA
step, the IML procedure, and SCL code. You use the MODULE family of SAS call
routines and functions (including MODULE, MODULEN, MODULEC, MODULEI, MODULEIN,
and MODULEIC) to invoke a routine that resides in an external DLL. This section
refers to the MODULE family of call routines and functions generically as
the MODULExy functions.
The general steps for accessing an external
DLL routine are
- Create a text file that describes the DLL routine
that you want to access, including the arguments that it expects and the values
that it returns (if any). This attribute file must be in a special format,
as described in The SASCBTBL Attribute Table.
- Use the FILENAME statement to assign the SASCBTBL
fileref to the attribute file that you created.
- In a DATA step or in SCL code, use a call routine
or function (MODULE, MODULEN, or MODULEC) to invoke the DLL routine. The specific
function that you use depends on the type of expected return value (none,
numeric, or character). (You can also use MODULEI, MODULEIN, or MODULEIC within
a PROC IML step.) The MODULExy functions are
described in MODULExy.
- CAUTION:
- Only experienced programmers should access
external DLLs.
By accessing a function in an external DLL,
you transfer processing control to the external function. If this is done
improperly, or if the external function is not reliable, you might lose data
or have to reset your computer (or both).
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.