• calvin's avatar
    branches/zip: implement the delayloading of externals for the plugin · fd683162
    calvin authored
    on Windows, which includes:
    
     * Load mysqld.map and insert all symbol/address pairs into hash for
       quick access
     * Resolves all external data variables. The delayloading mechanism
       in MSVC does not support automatic imports of data variables.
       A workaround is to explicitly handle the data import using the delay
       loader during the initialization of the plugin.
     * Resolves all external functions during run-time, by implementing
       the delayed loading helper function delayLoadHelper2, which is
       called by run-time as well as HrLoadAllImportsForDll. 
    
    The delay loader reuses the hash implementation in InnoDB. The normal
    hash_create (in hash0hash.c) creates hash tables in buffer pool. But
    the delay loader is invoked before the engine is initialized, and 
    buffer pools are not ready yet. Instead, the delay loader has its own
    implementation of hash_create() and hash_table_free(), called
    wdl_hash_create() and wdl_hash_table_free().
    
    This patch should be used with other two patches in order to build
    a dynamically linked plugin on Windows:
     * patch for tmpfile functions (r2886)
     * patch for "build" files (to be committed)
     
    The list of file changed:
    
    handler/handler0vars.h: new file, defines a list of external data
    variables (no external functions).
    
    handler/win_delay_loader.cc: new file, the implementation of the delay
    loader for Windows plugin.
    
    handler/ha_innodb.cc: add a header file, and changes for copying the
    system variables.
    
    handler/handler0alter.cc: add a header file
    
    handler/i_s.cc: add a header file
    
    rb://27
    
    Reviewed by:	Sunny, Marko
    Approved by:	Sunny
    fd683162
win_delay_loader.cc 21 KB