Quick loading of run time dynamic link library for OS/2

Electrical computers and digital processing systems: multicomput – Computer-to-computer data routing – Least weight routing

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

Reexamination Certificate

active

06292843

ABSTRACT:

BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to computer programming and, in particular, to a method of exporting functions of a dynamic link library for execution by an application program on a computer.
2. Description of Related Art
Computer operating systems such as OS/2 and Windows utilize dynamic link libraries as executable modules which contain services that application programs may utilize to perform different functions. Each dynamic link library (DLL) module may be written to contain a plurality of functions that may be utilized by different application programs running at the same time.
In addition, dynamic link libraries may be utilized to contain data and hardware such as typeface fonts in the case of the former and device drivers in the case of the latter. The dynamic link library is normally loaded into memory when an application program is running, and is not inserted into the executable file of the application program, such that the application program and dynamic link library are physically distinct.
Normally a programmer who develops a dynamic link library module that exports a plurality of functions has to create an explicit entry for each function exported in the DLL module definition file. In addition to the module definition file, each function must be prototyped, loaded and queried for its address. In the case of DLL software on the OS/2 operating system (available from International Business Machines Corporation) that exports 600 functions, there must be entered 600 lines of program in the module definition file, 600 lines for the function prototype, and 1200 lines for load and address query to the application protocol interface (API). Additionally, there may be another 601 lines of programming to function for error recovery. This may lead to a total of 1202 lines of overhead program.
In addition, the typical prior art DLL module would make over 600 calls to the operating system in order to execute the 600 DLL module functions. Every call to the operating system (also known as the kernel) is costly because of the extra processing time in the ring transition from ring
3
to ring
0
(discussed further below).
A prior art dynamic link library module OLDDLL.C for making available to application programs printing of the greetings Good Morning, Good Afternoon and Good Evening would typically include the following instructions (unless otherwise indicated, all programs herein are written in C programming language):
*/
#define INCL_DOSDATETIME
#define INCL_DOSFILEMGR
#define INCL_DOSMEMMGR
#include<os2.h>
#include<stdio.h>
#include<io.h>
#include<stdlib.h>
#include<math.h>
Func_A ( )
{
printf(“Good Morning
”);
}
Func_B ( )
{
printf(“Good Afternoon\n”);
}
Func_C ( )
{
printf(“Good Evening\n”):
}
The DLL module OLDDLL.C as described has three functions, i.e., printing out the separate phrases Good Morning, Good Afternoon and Good Evening, when requested by an application program. These phrases are contained as Function A, Function B and Function C, respectively.
A typical prior art DLL definition file OLDDLL.DEF would include the following instructions:
LIBRARY olddll INITINSTANCE TERMINSTANCE; tells linker to build DLL, not EXE
DATA MULTIPLE NONSHARED
EXPORTS
Func
—A
Func
—B
Func
—C
The file OLDDLL.DEF is the definition file which must be given to the operating system complied at the time the program is to be complied. The lines following EXPORT list every function which may be exported from the DLL, Func_A, Func_B and Func_C. For a DLL file having N functions, there would be N lines of programming in the EXPORT list.
A typical prior art executable application program TESTOLD.C would include the following instructions:
*/
#define INCL_WIN
#define INCL_DOS
#include <os2.h>
/* System Include File
*/
#include<stdio.h>
#include<process.h>
#include<stdlib.h>
CHAR  objbuff [100];
HMODULE hmodScreen;
void ( *pfnFunc_A) (void);
void ( *pfnFunc_B) (void);
void ( *pfnFunc_C) (void);
main( )
{
APIRET rc”;
rc = DosLoadModule  (objbuff,  100,  “OLDDLL.C”,
&hmodScreen )”;
if(rc) {
 printf(“Error: Loading the DLL\n”);
 ErrorHandler( );
 cleanup( );
}
rc = DosQueryProcAddr (hmodScreen, O, “Func_A”,
(PFN *)&pfnFunc_A);
if(rc) {
printf(“Error: Query Address for funcA\n”);
ErrorHandler( );
cleanup( );
}
rc = DosQueryProcAddr (hmodScreen, O, “Func_B”,
(PFN *)&pfnFunc_B );
if(rc) {
printf(“Error: Query Address for funcB\n”);
ErrorHandler( );
cleanup( );
}
rc = DosQueryProcAddr (hmodScreen, O, “Func_C”,
(PFN *)&pfnFunc_C );
if(rc) {
printf(“Error: Query Address for funcC\n”);
ErrorHandler( );
cleanup( );
}
pfnFunc_A( );
pfnFunc_B( );
pfnFunc_C( );
rc=DosFreeModule(hmodScreen);
if(rc)
  printf(“Error: DosFreeModule failed rc=%d\n”,rc);
}
ErrorHandler( )
{
;
}
cleanup( )
{
;
}
The DosLoadModule statement is an API call to the OS/2 operating system kernel to load the DLL “OLDDLL.C”. After loading the DLL the return code (rc) is checked. Then the statement DosQueryProcAddr is used to query each of the addresses of the functions A, B and C. Each DosQueryProcAddr is a separate API call to the OS/2 kernel. The application program then is able to use the DosQueryProcAddr by the statement pfnFunc_A, pfnFunc_B or pfnFunc_Cwithin the DLL.
In operating the DLL module, there are a total of four API calls made to the operating system kernel, one to load the DLL and one for each of the three functions within the DLL module. For the example of 600 functions, there would be 601 API calls to the kernel. Likewise, the number of calls to the kernel for a DLL module having N function is N+1.
Accordingly, it is quite complex and costly in terms of computer execution time to increase the number of functions in a DLL available for use by an application program.
Bearing in mind the problems and deficiencies of the prior art, it is therefore an object of the present invention to provide a dynamic link library that provides better performance and fewer program lines to run.
It is another object of the present invention to provide a smaller application program which uses a DLL module.
A further object of the present invention is to provide a smaller module definition file in the DLL.
It is yet another object of the present invention to provide for fewer API calls to the operating system kernel during DLL module use.
A further object of the present invention is to provide improvement in the performance utilizing a DLL module.
Still other objects and advantages of the invention will in part be obvious and will in part be apparent from the specification.
SUMMARY OF THE INVENTION
The above and other objects, which will be apparent to those skilled in the art, are achieved in the present invention which provides in one aspect a process for exporting functions of a dynamic link library to an executable program on a computer by providing a dynamic link library module adapted to export a plurality of desired functions, with each of the desired functions having a unique identification. The dynamic link library module includes a dispatching function adapted to recognize the unique identification of each of the desired functions and export the desired function for execution by the program. There is also provided a look-up table for the executable program having therein a listing for each of the desired functions and unique identifications. The process includes loading the dynamic link library module with the program and calling the desired function by passing the desired function identification from the program to the dispatching function. Thereafter, the desired function is exported from the dynamic link library module to the program.
A plurality of functions may be called by passing the desired function identification for each of the f

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Quick loading of run time dynamic link library for OS/2 does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Quick loading of run time dynamic link library for OS/2, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Quick loading of run time dynamic link library for OS/2 will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-2441327

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.