Browse Prior Art Database

Dynamic and Transparent Loading of Dynamic Link Libraries in an OO Environment

IP.com Disclosure Number: IPCOM000111102D
Original Publication Date: 1994-Feb-01
Included in the Prior Art Database: 2005-Mar-26
Document File: 4 page(s) / 174K

Publishing Venue

IBM

Related People

Carley, SG: AUTHOR [+3]

Abstract

The Dynamic Link Library (DLL) support provided by Digitalk in their Smalltalk V/PM 1.3 product allows DLLs to be created to reduce the size of the main executable (*.EXE file). However, loading of the DLLs when they are needed during program execution requires an explicit request (message) that the required DLL be loaded. This means that every place within the system that might use the code in any of the system's DLLs must check to see if the appropriate DLL has been loaded, and if not, ask that it be loaded prior to continuing with execution. This is extremely inconvenient and causes the source code to be very dependent upon the eventual packaging of the system into DLLs. Packaging considerations, such as the most efficient manner in which to create DLLs, should not affect the system's source code in any way.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 29% of the total text.

Dynamic and Transparent Loading of Dynamic Link Libraries in an OO
Environment

      The Dynamic Link Library (DLL) support provided by Digitalk in
their Smalltalk V/PM 1.3 product allows DLLs to be created to reduce
the size of the main executable (*.EXE file).  However, loading of
the DLLs when they are needed during program execution requires an
explicit request (message) that the required DLL be loaded.  This
means that every place within the system that might use the code in
any of the system's DLLs must check to see if the appropriate DLL has
been loaded, and if not, ask that it be loaded prior to continuing
with execution.  This is extremely inconvenient and causes the source
code to be very dependent upon the eventual packaging of the system
into DLLs.  Packaging considerations, such as the most efficient
manner in which to create DLLs, should not affect the system's source
code in any way.  Otherwise, the separate processes of creating
source code and then packaging the system become tightly coupled,
less flexible and far more prone to errors.

      Disclosed is a technique to allow DLLs to truly be linked and
loaded dynamically, when needed, without the requirement that
explicit load requests be spread throughout the source code.  NOTE:
This technique assumes that DLLs are built on a class basis.  In
other words, the class definition and all class and instance methods
for the class are contained within a single DLL.  A more complex
technique could be defined to allow a class to be split between
various DLLs, but that is beyond the scope of this disclosure.

      The technique to allow loading of DLLs to be dynamic and
transparent to any code that requires services from classes that are
in a DLL involves the following three steps:

1.  Change all class name references in the system, such as when an
    instance of the class is created or when a class method is
    invoked, to use the more explicit reference technique of sending
    a message to the system dictionary of classes to retrieve the
    class.  (In Smalltalk V implementations, this message is sent to
    the global Smalltalk, which is an instance of the class
    SystemDictionary.)  This allows the message to be intercepted so
    that the situation where a class that does not yet exist in the
    system because its respective DLL, has not yet been loaded can be
    detected and trigger the loading of the DLL.  For example, the
    following Smalltalk code segment that creates a new instance of
    class BankAccount:

                 myBankAccount := BankAccount new.

         would be changed to:

                 myBankAccount := (Smalltalk at: #BankAccount) new.

    Sending the message is effectively what happens in the virtual
    machine that Digitalk provides.  However, with their lookup
    technique, there is no way to intercept the reference to
    BankAcco...