Kbase P161575: External procedure declaration can be used in class file
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/10/2010 |
|
Status: Unverified
SYMPTOM(s):
External procedure declaration can be used in class file
PROCEDURE ... EXTERNAL ... syntax in class file does not raise an error 12910
Procedures and user-defined functions may not be defined in a class or interface file. (12910)
FACT(s) (Environment):
OpenEdge 10.2B
All Supported Operating Systems
CAUSE:
Bug# OE00196045
CAUSE:
Support for external DLL/shared library procedures in class files was introduced in OpenEdge 10.2B, but this was not documented.
FIX:
The functionality can be used as is, and is supported.
The following code sample shows the expected behavior. It compiles and runs successfully on OpenEdge 10.2B and later.
Note that it must be run on a Windows platform only because it uses one of the Windows API functions. Other library calls on other platforms will also work.
This class file compiles:
/* WindowsMessageBox.cls - defines and uses a DLL procedure */
CLASS WindowsMessageBox :
PROCEDURE MessageBoxA EXTERNAL "user32.dll":
DEFINE INPUT PARAMETER hwnd AS LONG.
DEFINE INPUT PARAMETER mbtext AS CHARACTER.
DEFINE INPUT PARAMETER mbtitle AS CHARACTER.
DEFINE INPUT PARAMETER style AS LONG.
DEFINE RETURN PARAMETER result AS LONG.
END.
METHOD PUBLIC INTEGER runWindowsProc ():
DEFINE VARIABLE iResult AS INTEGER NO-UNDO.
RUN MessageBoxA (0,
" It's a whole new world, again!!",
"ABL DLL Access",
0,
OUTPUT iResult).
RETURN iResult.
END.
END CLASS.
The following code shows that the class also runs:
/* testMessageBox.p */
DEFINE VARIABLE myMessageBox AS WindowsMessageBox NO-UNDO.
myMessageBox = NEW WindowsMessageBox().
myMessageBox:runWindowsProc().
DELETE OBJECT myMessageBox.