HP-UX SNAplus2 R7 LUA Programmer's Guide
Designing and Writing LUA Applications
Writing Portable Applications
DWORD parameters are on DWORD boundaries, WORD parameters are on WORD boundaries, and BYTE
parameters are on BYTE boundaries.
Header File
The header file to be included in Windows LUA applications is named winlua.h. This file is installed in the
subdirectory /sdk within the directory where you installed the Windows Client software.
Load-Time Linking
To link the program to LUA at load time, link the program to the winsli32.lib library.
Run-Time Linking
To link the program to LUA at run-time, include the following calls in the program:
• LoadLibrary to load the LUA dynamic link library winsli32.dll.
• GetProcAddress to specify each of the LUA entry points required (such as SLI)
• FreeLibrary when the library is no longer required.
2.8.3 Terminating Applications
If an application must close (for example, if it receives a WM_CLOSE message as a result of an
[ALT] [F4]
from
a user), it should call the WinRUICleanup or WinSLICleanup function before terminating. If it does not do
this, then the application is left in an indeterminate state, although as much cleanup as possible is done when the
Windows LUA software detects that the application has terminated.
2.9 Writing Portable Applications
SNAplus2’s implementation of LUA is designed to be compatible with the implementation provided by IBM’s OS/
2 Extended Edition. However, there are a few differences between the implementations that are due to fundamental
operating system differences. These operating system differences are indicated in the individual verb descriptions.
In particular:
• The RUI_REINIT verb is an extension to the standard LUA interface specification. It is not available in the
Windows LUA implementation in SNAplus2, and may not be available in other LUA implementations.
• Other LUA implementations generate certain additional return codes that are not returned by the SNAplus2
implementation; they may also make use of parameters that are reserved for SNAplus2.
• OS/2 and Windows implementations use far pointers (far *) in all cases; HP-UX implementations do not have
a concept of far and near pointers, so the word far must be omitted for HP-UX implementations.
• The asynchronous verb return feature is supported differently by different operating systems. You may need to
rewrite the sections of an LUA application written for one operating system that relate to asynchronous verb
returns if you are porting the application to another operating system.
• Other LUA implementations may not support LU pools.
The following guidelines are provided for writing SNAplus2 LUA applications so that they will be portable to other
environments:
• Include the LUA header file without any path name prefix. This enables the application to be used in an
environment with a different file system. Use include options on the compiler to locate the file (see Section
2.7.3, Compiling and Linking the LUA Application).
51