Unload Method (MODULE)
PLBCMP GUI Only, 10.6
The Unload method allows the current load module to be unloaded and removed from the OS memory. This method can only be executed in the PL/B logic of a load module. This method cannot be executed for a standalone PL/B program. Otherwise an O167 error occurs. This method can only be used when the PL/B runtime PLB_DYNAMICLOADMOD keyword is turned on. Otherwise an O167 error occurs. This method uses the following format:
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. A MODULE that is accessed.
return
Optional. A Numeric Variable whose value represents the success or failure of the method.
flags
Optional. A Numeric Variable or decimal number that identifies a bit mask where each bit invokes a behavior for this method.
Flags Affected: EOS, OVER, ZERO
Note the following:
The EOS flag is always cleared.
The ZERO flag is set TRUE if the {return} value is zero. Otherwise, the ZERO flag is set to FALSE.
The OVER flag is set TRUE if the {return} variable is too small to receive the value without being truncated.
If the current program/load module cannot be re-initialized, an O167 error occurs. In this case or a module, an O167 error if the PL/B call stack contains multiple return stack entries to the load module being unloaded.
The {flags} bit values are implemented to invoke behaviors for the method as follows:
|
Flag Values |
Description |
|
0x1 |
This bit mask value causes the Unload method to return a numeric result and the O167 error does not occur. |
Successful execution of the MODULE Unload method occurs as follows:
A. The load module UDA is re-initialized to detach all pointers.
B. All load module DMAKE type allocations are freed.
C. All load module files are closed.
D. All GUI objects are destroyed.
E. All XData, DateTime, FTP, COMFILE, and Collections are closed and cleared.
F. All of the current load module pending program/user events are cleared.
G. The current load module is removed from the PL/B runtime process descriptor linkage.
H. The current load module memory is cleared and the memory is released back to the OS.
When an O167 error occurs, the extended data is reported as follows where the result is a subcode. I f the '*FLAGS=1' option is used, only the result is returned in the {return} numeric variable and the O167 error does not occur.
|
Result |
Description |
|
1 |
Module data not found! |
|
2 |
Module UDA copy not available! |
|
3 |
Call stack depth 1 level minimum! |
|
4 |
Form object cleanup error! |
|
5 |
No client support! (Plbclient used) |
|
6 |
Client response incomplete! (Plbclient used) |
|
10 |
Dynamic Loadmod required! |
|
20 |
Call stack empty not allowed! |
|
21 |
Invalid stack entry bad addr! |
|
24 |
Modal stack entry! |
|
25 |
Call Stack duplicate error! |
See Also: Module Methods, Method Syntax
![]() |