Annotation of os2sdk/demos/examples/dynlink/readme, revision 1.1.1.1

1.1       root        1: 
                      2: This directory contains illustrations of the creation and use of dynamic link
                      3: libraries.  The library itself is constructed in one of two different ways:
                      4: 
                      5:     1. entirely in assembly code
                      6:     2. nearly all in C, with an assembly stub module
                      7: 
                      8: The initialization entry point to the dynalink library must be defined in
                      9: an assembly module, which can contain all of its own code or can make
                     10: a call to a routine in a C module.
                     11: 
                     12: Your library can have several data segments, each which is global (SHARED)
                     13: to all applications using the library or is duplicated (NONSHARED) for each
                     14: application.  An example would be a pseudo graphics driver.  The
                     15: "per-instance" data could be structures representing windows owned by each
                     16: application.  The global data could be semaphores used to serialize access to
                     17: the hardware.
                     18: 
                     19: -------------------------------------------------------------------------------
                     20: The application:
                     21: 
                     22: There are two methods of linking to a dynamic link library:
                     23: 
                     24:     1. at load time
                     25:     2. at run time
                     26: 
                     27: The first method is less complicated in that the system takes care of
                     28: all fixup and loading of the library.  The second method is more
                     29: comprehensive in that it allows the application to determine if a library
                     30: exists, and make a choice of whether or not to use it.
                     31: 
                     32: The latter would be preferred in applications that need to run in environments
                     33: lacking in certain libraries.  For example, a package could make good use of
                     34: a fancy high resolution graphics board.  However, if the product wasn't
                     35: present the application could fall back to the standard VIO graphics (such as
                     36: they are).
                     37: 
                     38: There are two ways of linking an application so that it can link to a dynalink
                     39: library at load time:
                     40: 
                     41:     1. the application can have a .DEF file which names the entry points
                     42:        of the dynalink library used by it
                     43:     2. IMPLIB can be used to create an IMPORTS library from the .DEF file
                     44:        of the dynalink library
                     45: 
                     46: The second method does away with the need for the application to define
                     47: a .DEF file.
                     48: 
                     49: -------------------------------------------------------------------------------
                     50: 
                     51: readme         this file
                     52: 
                     53: dynlink.cmd    front end for "make dynlink"
                     54: 
                     55:                    Sets up the environment for constructing the dll either
                     56:                    from C modules ("dynlink c") or from the asm module
                     57:                    ("dynlink asm"), then invokes "make dynlink".
                     58: 
                     59: dynlink        makefile
                     60: 
                     61:                    NB - The LIB and INCLUDE environment variables must be
                     62:                    set correctly.  LIB is the search path for LINK and
                     63:                    INCLUDE is the search path for CL.
                     64: 
                     65:                    NB - LIBPATH can be set (in CONFIG.SYS) to start in the
                     66:                    current directory. eg. LIBPATH=.;C:\;C:\LIB
                     67: 
                     68: dynlib.h       defines calling conventions for the library routines
                     69: 
                     70: dynlib.def     contains library information for the linker and loader
                     71: 
                     72:                    This file is used to create the import library for the dll.
                     73: 
                     74: dyninit.asm    contains initialization routine entry point
                     75: dynlib.c       data segment is per-instance
                     76: dynlib2.c      data segment is global
                     77: 
                     78: near           subdirectory with C modules where data is not declared far
                     79: far            subdirectory containing the far-data versions of the C modules
                     80: 
                     81:                    NB - Both near & far assume small-model compilation.
                     82: 
                     83: dynlib3.asm    assembly version
                     84: 
                     85: dynlink.def    IMPORTs the entry points of the dll
                     86: 
                     87: dynlink1.c     links to the dll at load time
                     88: dynlink2.c     links to the dll at run time
                     89: 
                     90: dyngo.cmd      brings up several copies of dyndemo2.exe
                     91: 
                     92:                    NB - LIBPATH must contain the root directory.
                     93: 
                     94: dyncvp.cmd     brings up CodeView
                     95: 
                     96:                    NB - If you want to single-step the program, you must
                     97:                    (with the cvp I am using, MS cvp v.2.00.10) use the
                     98:                    right mouse button to execute to the next instruction,
                     99:                    immediately upon entering cvp.  Then you can use F8
                    100:                    to single-step to your heart's content.
                    101:                         Also, for the time being, cvp requires that your
                    102:                    dll reside in the root directory of your boot disk.
                    103:                    This requirement will go away.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.