Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

Overview of Dynamic Link Libraries in the SAS System

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. Version 8 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 documentation 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

  1. Create a text file that describes the DLL routine you want to access, including the arguments it expects and the values it returns (if any). This attribute file must be in a special format, as described in The SASCBTBL Attribute Table.

  2. Use the FILENAME statement to assign the SASCBTBL fileref to the attribute file you created.

  3. In a DATA step or SCL code, use a call routine or function (MODULE, MODULEN, or MODULEC) to invoke the DLL routine. The specific function 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 done improperly, or if the external function is not reliable, you might lose data or have to reset your computer (or both).  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.