Load on call
Clarion 16 Bit version use to support very good feature - Called Load on call.
Meaning - Libraries (DLLS) were not loaded along with EXE - But as the procedures are being called the OS used to load the Libraries smartly. This was saving initial load time of application (Time taken before the first line of user code got executed)
Unfortunately in 32 Bit version, this compiler directive is not supported anymore.
This becomes important when the application is multi-dll and grows like 100+ DLLs
i have seen the loading of the DLLS as Clarion EXE tries to load every DLL connected some how or the other at startup and taking like 10 second or more in some instance
not only time it also contributes to the footprint the application needs to run it
C6 has a new feture that can be used to achieve this - its little limited but hey its better than nothing, isnt it?
---------------------------------------------------------------------------------
CALL( file, procedure [, flags ] )
CALL Calls a procedure that has not been prototyped in the application's MAP structure from a Windows standard .DLL.
file - A string constant, variable, or expression containing the name (including extension) of the .DLL to open. This may include a full path.
procedure - A string constant, variable, or expression containing the name of the procedure to call (which may not receive parameters or return a value). This can also be the ordinal number indicating the procedure's position within the .DLL.
flags - An UNSIGNED integer constant, variable, or expression containing bitmap flag settings.
The CALL procedure calls a procedure from a Windows-standard .DLL. The procedure does not need to be prototyped in the application's MAP structure. If it is not already loaded by Windows, the .DLL file is loaded into memory. The .DLL file is automatically unloaded from memory when the procedure terminates unless the lowest flags bit is set to one (1). A .DLL file left loaded may be explicitly unloaded with the UNLOAD procedure.
CALL returns zero (0) for a successful procedure call. If unsuccessful, it can return one of the following mapped error values, or any other valid Windows level error code:
-1 Procedure name cannot be resolved in a specified .DLL
2 File not found
3 Path not found
5 Attempted to load a task, not a .DLL
6 Library requires separate data segments for each task
10 Wrong Windows version
11 Invalid .EXE file (DOS file or error in program header)
12 OS/2 application
13 DOS 4.0 application
14 Unknown .EXE type
15 Attempt to load an .EXE created for an earlier version of Windows. This error will not occur if Windows is run in Real mode.
16 Attempt to load a second instance of an .EXE file containing multiple,writeable data segments.
17 EMS memory error on the second loading of a .DLL
18 Attempt to load a protected-mode-only application while Windows is running in Real mode
Return Data Type: SIGNED
Example:
X# = CALL('CUSTOM.DLL','1') !Call first procedure in CUSTOM.DLL
IF X# THEN STOP(X#). !Check for successful execution
You can create a simple function and use that to call what ever you want
CallDLLThread FUNCTION (P_DLLNAME,P_PROCEDURE) ! Declare Procedure
LOC:ERRORCODE BYTE !
CODE ! Begin processed code
LOC:ERRORCODE = CALL(P_DLLNAME,P_PROCEDURE&'@F',1)
DO ALERTUSER
ALERTUSER ROUTINE
CASE LOC:ERRORCODE
OF -1
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 2
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 3
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 5
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 6
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 10
MESSAGE(P_DLLNAME& 'window indicates wrong window version',E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 11
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 12
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 13
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 14
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 15
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 16
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 17
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 18
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME,E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
OF 0
RETURN(TRUE)
ELSE
MESSAGE(P_PROCEDURE&' window name is not resolved in library'&P_DLLNAME&' Error : '&ERROR(),E_PowerLAB,ICON:ASTERISK,BUTTON:OK)
RETURN(FALSE)
END


0 Comments:
Post a Comment
<< Home