February 17, 2006 Tips on using DWT | ||||
---|---|---|---|---|
| ||||
#0 Patching DWT 0.35 Before you build the library, change line #1673 of import\dwt\internal\win32\wintypes.d from: void uJustification(uint val) { BITS & 0xF0; BITS |= (val & 0x0F); } to: void uJustification(uint val) { BITS &= 0xF0; BITS |= (val & 0x0F); } (This bug was not noticed until Walter fixed D.bugs/4829 in dmd 0.146.) #1 Reducing executable size If you do not use OLE, COM, Drag-and-Drop features, change line #6 of import\make-dwt-lib.bat to: build -release -clean -inline -w -lib -full -allobj dwt\all.d -T..\lib\dwt.lib then rebuild the whole library and your DWT application. You will notice a 20%~30% decrease in executable size. You may further squeeze some kilobytes out by removing unused import statements in import\dwt\all.d. #2 Speeding up compilation Instead of writing "import dwt.all;" at the beginning of your source, import only those modules you actually need. For example, modify the 4th line of package\dwt\examples\misc\hello.d from: import dwt.all to: import dwt.widgets.shell, dwt.widgets.display, dwt.widgets.messagebox; And compile it using the following command line: dmd hello.d -release -O -L/subsystem:windows:5 dwt.lib advapi32.lib comctl32.lib gdi32.lib shell32.lib user32_dwt.lib msimg32_dwt.lib usp10_dwt.lib gdi32_dwt.lib kernel32_dwt.lib |
Copyright © 1999-2021 by the D Language Foundation