Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ef98bac1a6ae141ca7f0a76ec4151bf6b951bdc5
Ticket: 533221ffffffffffffffffffffffffffffffffff
Problems with binary packages on NT 4.0
User & Date: kennykb on 2002-03-23 05:04:31
Changes

  1. icomment:
    Logged In: YES 
    user_id=99768
    
    The change from lazy to eager loading in 8.4 was by design,
    but in any case seems irrelevant to the main point of this
    bug report.
    
    The double loading of a DLL is hard to explain, particularly
    in light of the fact that the LoadLibrary call, which
    tclWinLoad.c uses internally, is documented never to load any
    DLL more than once.  The only explanation that I can easily
    arrive at is that the DLL found when resolving the import
    table of the executable was NOT the same file -- or at least,
    did not have the same path name (I'm not sure what happens
    if LoadLibrary is called with short name versus long name.)
    It's conceivable that NT 4.0 in particular has a bug in this
    area, but I haven't found anything in a cursory search of
    MSDN.
    
    In any case, the [load] command has no way of being aware
    what DLLs may be present in the process as a result of
    arbitrary C code.
    
    Your solution of packaging the C API's separately from their
    TCL wrappers is a good one if it's practicable; at least,
    it means that you don't have a <package>_Init function
    that's never called floating around in the executable
    somewhere.
    
    Another good idea is to do compatibility checking inside
    your pkgIndex.tcl files. This is not done easily if they
    are made by pkg_mkIndex, but it's actually easier in most
    cases to build the indices by hand!
    
    Don's suggestion of doing Tcl_StaticPackage for all packages
    that you know to be statically linked is also good practice.
    Adding appropriate [package ifneeded] calls at initialization
    will then load the statically linked packages without
    needing to resort to LoadLibrary.
    
    Another good practice would be to use the Stubs mechanism,
    both for backlinking to Tcl itself and for crosslinking among
    your load modules.  This can often reduce or eliminate the
    dependencies among the DLLs so that you don't need as many
    multiple copies of things.
    
    Finally, I'd suggest that you audit your NT 4.0 test
    configuration and make sure that your "doubly loaded" DLL
    isn't turning up someplace unexpected.  Given the way that
    LoadLibrary works, it's hard to imaging the double loading
    actually happening any other way.
    
    
  2. login: "kennykb"
  3. mimetype: "text/plain"
  4. username: "kennykb"