Changeset 79:67d24430822a

Show
Ignore:
Timestamp:
02/06/08 05:08:01 (1 year ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Delayed DLL load

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/dwthelper/utils.d

    r78 r79  
    148148} 
    149149 
    150 struct GCStats { 
     150private struct GCStats { 
    151151    size_t poolsize;        // total size of pool 
    152152    size_t usedsize;        // bytes allocated 
     
    155155    size_t pageblocks;      // number of blocks marked PAGE 
    156156} 
    157 extern(C) GCStats gc_stats(); 
     157private extern(C) GCStats gc_stats(); 
     158 
    158159size_t RuntimeTotalMemory(){ 
    159160    GCStats s = gc_stats(); 
     
    161162} 
    162163 
    163 } 
    164164 
    165165 
  • dwt/internal/gdip/native.d

    r78 r79  
    1313module dwt.internal.gdip.native; 
    1414 
    15 private import dwt.internal.win32.WINTYPES; 
    16 // private import tango.core.Memory; 
     15import dwt.internal.win32.WINTYPES; 
     16import tango.sys.SharedLib : SharedLib; 
     17import tango.util.log.Trace; 
    1718 
    1819extern(Windows): 
     
    722723Status GdipSetStringFormatTabStops( Handle format, float firstTabOffset, int count, float* tabStops); 
    723724 
     725void loadLib_Gdip(){ 
     726    // do nothing in this version 
     727} 
    724728 
    725729} 
     
    16721676]; 
    16731677 
    1674 
    1675  
     1678 
     1679void loadLib_Gdip(){ 
     1680    if (auto lib = SharedLib.load(`gdiplus.dll`)) { 
     1681        foreach( inout s; symbols ){ 
     1682            *s.symbol = lib.getSymbol( s.name.ptr ); 
     1683            if( s.symbol is null ){ 
     1684                Trace.formatln("gdiplus.dll: Symbol '{}' not found", s.name ); 
     1685            } 
     1686        } 
     1687    } else { 
     1688        Trace.formatln("Could not load the library gdiplus.dll"); 
     1689    } 
     1690
     1691 
     1692
    16761693 
    16771694/****************************************************************************** 
  • dwt/internal/win32/OS.d

    r78 r79  
    1919import dwt.internal.C; 
    2020import dwt.internal.Library; 
     21import tango.sys.SharedLib : SharedLib; 
     22import tango.util.log.Trace; 
    2123 
    2224 
     
    5860 
    5961public class OS : C { 
     62 
     63    struct Symbol { 
     64        char[] name; 
     65        void** symbol; 
     66    } 
    6067 
    6168    public static HINSTANCE GetLibraryHandle(){ 
     
    40724079// UxTheme dummies until dynamic loading is in place. 
    40734080// ---------------------------------------------------------------------------- 
    4074 public static { 
    4075     BOOL IsAppThemed(){ 
    4076         return 0; 
    4077     } 
    4078  
    4079     HRESULT DrawThemeBackground( 
     4081public static extern(Windows) { 
     4082    BOOL function ( 
     4083    ) IsAppThemed; 
     4084 
     4085    HRESULT function( 
    40804086        HTHEME hTheme, 
    40814087        HDC hdc, 
     
    40844090        RECT *pRect, 
    40854091        RECT *pClipRect 
    4086     ) 
    4087     { 
    4088         return S_OK; 
    4089     } 
    4090  
    4091  
    4092     HRESULT DrawThemeEdge( 
     4092    ) DrawThemeBackground; 
     4093 
     4094    HRESULT function( 
    40934095        HTHEME hTheme, 
    40944096        HDC hdc, 
     
    40994101        UINT uFlags, 
    41004102        LPRECT pContentRect 
    4101     ) 
    4102     { 
    4103         return S_OK; 
    4104     } 
    4105  
    4106  
    4107     HRESULT DrawThemeIcon( 
     4103    ) DrawThemeEdge; 
     4104 
     4105    HRESULT function( 
    41084106        HTHEME hTheme, 
    41094107        HDC hdc, 
     
    41134111        HIMAGELIST himl, 
    41144112        int iImageIndex 
    4115     ) 
    4116     { 
    4117         return S_OK; 
    4118     } 
    4119  
    4120  
    4121     HRESULT DrawThemeParentBackground( 
     4113    ) DrawThemeIcon; 
     4114 
     4115    HRESULT function( 
    41224116        HWND hwnd, 
    41234117        HDC hdc, 
    41244118        RECT *prc 
    4125     ) 
    4126     { 
    4127         return S_OK; 
    4128     } 
    4129  
    4130     HRESULT DrawThemeText( 
     4119    ) DrawThemeParentBackground; 
     4120 
     4121    HRESULT function( 
    41314122        HTHEME hTheme, 
    41324123        HDC hdc, 
     
    41384129        DWORD dwTextFlags2, 
    41394130        LPCRECT pRect 
    4140     ) 
    4141     { 
    4142         return S_OK; 
    4143     } 
    4144  
    4145     HTHEME OpenThemeData( 
     4131    ) DrawThemeText; 
     4132 
     4133    HTHEME function( 
    41464134        HWND hwnd, 
    41474135        LPCWSTR pszClassList 
    4148     ) 
    4149     { 
    4150         return null; 
    4151     } 
    4152  
    4153  
    4154     HRESULT BufferedPaintInit(){ 
    4155         return S_OK; 
    4156     } 
    4157  
    4158     HRESULT CloseThemeData( 
     4136    ) OpenThemeData; 
     4137 
     4138    HRESULT function( 
     4139    )BufferedPaintInit; 
     4140 
     4141    HRESULT function( 
    41594142        HTHEME hTheme 
    4160     ){ 
    4161         return S_OK; 
    4162     } 
    4163  
    4164  
    4165     HRESULT BufferedPaintUnInit(){ 
    4166         return S_OK; 
    4167     } 
    4168  
    4169     HPAINTBUFFER BeginBufferedPaint( 
     4143    ) CloseThemeData; 
     4144 
     4145    HRESULT function( 
     4146    ) BufferedPaintUnInit; 
     4147 
     4148    HPAINTBUFFER function( 
    41704149        HDC hdcTarget, 
    41714150        RECT *prcTarget, 
     
    41734152        void*/+BP_PAINTPARAMS+/ pPaintParams, 
    41744153        HDC *phdc 
    4175     ){ 
    4176         return null; 
    4177     } 
    4178  
    4179  
    4180     HRESULT EndBufferedPaint( 
     4154    ) BeginBufferedPaint; 
     4155 
     4156    HRESULT function( 
    41814157        HPAINTBUFFER hBufferedPaint, 
    41824158        BOOL fUpdateTarget 
    4183     ){ 
    4184         return S_OK; 
    4185     } 
    4186  
    4187     HRESULT GetThemeTextExtent( 
     4159    ) EndBufferedPaint; 
     4160 
     4161    HRESULT function( 
    41884162        HTHEME hTheme, 
    41894163        HDC hdc, 
     
    41954169        LPCRECT pBoundingRect, 
    41964170        LPRECT pExtentRect 
    4197     ) 
    4198     { 
    4199         return S_OK; 
    4200     } 
    4201  
    4202     HRESULT SetWindowTheme( 
     4171    ) GetThemeTextExtent; 
     4172 
     4173    HRESULT function( 
    42034174        HWND hwnd, 
    42044175        LPCWSTR pszSubAppName, 
    42054176        LPCWSTR pszSubIdList 
    4206     ) 
    4207     { 
    4208         return S_OK; 
    4209     } 
     4177    ) SetWindowTheme; 
     4178 
    42104179} // public static 
    42114180 
     4181static Symbol[] Symbols_UxTheme = [ 
     4182    { "IsAppThemed", cast(void**)& IsAppThemed }, 
     4183    { "DrawThemeBackground", cast(void**)& DrawThemeBackground }, 
     4184    { "DrawThemeEdge", cast(void**)& DrawThemeEdge }, 
     4185    { "DrawThemeIcon", cast(void**)& DrawThemeIcon }, 
     4186    { "DrawThemeParentBackground", cast(void**)& DrawThemeParentBackground }, 
     4187    { "DrawThemeText", cast(void**)& DrawThemeText }, 
     4188    { "OpenThemeData", cast(void**)& OpenThemeData }, 
     4189    { "BufferedPaintInit", cast(void**)& BufferedPaintInit }, 
     4190    { "CloseThemeData", cast(void**)& CloseThemeData }, 
     4191    { "BufferedPaintUnInit", cast(void**)& BufferedPaintUnInit }, 
     4192    { "BeginBufferedPaint", cast(void**)& BeginBufferedPaint }, 
     4193    { "EndBufferedPaint", cast(void**)& EndBufferedPaint }, 
     4194    { "GetThemeTextExtent", cast(void**)& GetThemeTextExtent }, 
     4195    { "SetWindowTheme", cast(void**)& SetWindowTheme }, 
     4196]; 
     4197 
     4198static void loadLib_UxTheme(){ 
     4199    if (auto lib = SharedLib.load(`uxtheme.dll`)) { 
     4200        foreach( inout s; Symbols_UxTheme ){ 
     4201            *s.symbol = lib.getSymbol( s.name.ptr ); 
     4202            if( s.symbol is null ){ 
     4203                Trace.formatln("UxTheme.dll: Symbol '{}' not found", s.name ); 
     4204            } 
     4205        } 
     4206    } else { 
     4207        Trace.formatln("Could not load the library UxTheme.dll"); 
     4208    } 
     4209} 
    42124210//---------------------------------------------------------------------- 
    42134211// Coreimm.lib (WinCE) 
     4212// this function vars exist primarily for link error elimination 
    42144213//---------------------------------------------------------------------- 
    42154214public static extern(Windows) { 
     
    43034302) ImmSetOpenStatus; 
    43044303 
    4305 } // public static 
     4304} // public static extern(Windows) 
     4305 
     4306static Symbol[] Symbols_CoreImm = [ 
     4307    { "ImmAssociateContext", cast(void**)& ImmAssociateContext }, 
     4308    { "ImmCreateContext", cast(void**)& ImmCreateContext }, 
     4309    { "ImmDestroyContext", cast(void**)& ImmDestroyContext }, 
     4310    { "ImmGetContext", cast(void**)& ImmGetContext }, 
     4311    { "ImmGetConversionStatus", cast(void**)& ImmGetConversionStatus }, 
     4312    { "ImmGetDefaultIMEWnd", cast(void**)& ImmGetDefaultIMEWnd }, 
     4313    { "ImmGetOpenStatus", cast(void**)& ImmGetOpenStatus }, 
     4314    { "ImmReleaseContext", cast(void**)& ImmReleaseContext }, 
     4315    { "ImmSetCompositionFont", cast(void**)& ImmSetCompositionFont }, 
     4316    { "ImmGetCompositionString", cast(void**)& ImmGetCompositionString }, 
     4317    { "ImmGetCompositionFont", cast(void**)& ImmGetCompositionFont }, 
     4318    { "ImmSetCompositionFont", cast(void**)& ImmSetCompositionFont }, 
     4319    { "ImmGetCompositionString", cast(void**)& ImmGetCompositionString }, 
     4320    { "ImmGetCompositionFont", cast(void**)& ImmGetCompositionFont }, 
     4321    { "ImmSetCompositionWindow", cast(void**)& ImmSetCompositionWindow }, 
     4322    { "ImmSetConversionStatus", cast(void**)& ImmSetConversionStatus }, 
     4323    { "ImmSetOpenStatus", cast(void**)& ImmSetOpenStatus }, 
     4324]; 
     4325 
     4326static void loadLib_CoreImm(){ 
     4327    if (auto lib = SharedLib.load(`coreimm.dll`)) { 
     4328        foreach( inout s; Symbols_CoreImm ){ 
     4329            *s.symbol = lib.getSymbol( s.name.ptr ); 
     4330            if( s.symbol is null ){ 
     4331                Trace.formatln("CoreImm.dll: Symbol '{}' not found", s.name ); 
     4332            } 
     4333        } 
     4334    } else { 
     4335        Trace.formatln("Could not load the library coreimm.dll"); 
     4336    } 
     4337
     4338 
    43064339//------------------------------------------------------------------------ 
    43074340/** All Natives */