Changeset 313

Show
Ignore:
Timestamp:
11/05/08 12:14:36 (2 months ago)
Author:
h3r3tic
Message:

patches from Craig Slusher - getDExport with a runtime name parameter and some Tango compatibility updates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ddl/DynamicLibrary.d

    r301 r313  
    139139            typeof(T) getDExport() { 
    140140            return cast(typeof(T))getSymbol("_D" ~  mangleSymbolName!(name) ~ T.mangleof).address; } 
     141        } 
     142    } 
     143 
     144    /** 
     145        Runtime method to do the exactly the same thing as the templated version 
     146    */ 
     147    template getDExport(T) { 
     148        static if(T.mangleof[0] == 'P'){ 
     149            typeof(T) getDExport(char[] name) { 
     150                return cast(typeof(T))getSymbol( "_D" ~  mangleNamespace(name) ~ T.mangleof[1..$]).address;  
     151                } 
     152        } else { 
     153            typeof(T) getDExport(char[] name) { 
     154            return cast(typeof(T))getSymbol("_D" ~  mangleNamespace(name) ~ T.mangleof).address; } 
    141155        } 
    142156    } 
  • trunk/ddl/FileBuffer.d

    r300 r313  
    3535        FileBuffer _this; 
    3636        _this.path = new FilePath(path);         
    37         _this.data = cast(ubyte[])(new File(_this.path)).read; 
     37        _this.data = cast(ubyte[])(new File(_this.path.toString)).read; 
    3838        return _this; 
    3939    } 
     
    4242        FileBuffer _this; 
    4343        _this.path = new FilePath(path.toString);        
    44         _this.data = cast(ubyte[])(new File(_this.path)).read; 
     44        _this.data = cast(ubyte[])(new File(_this.path.toString)).read; 
    4545        return _this; 
    4646    } 
     
    6565     
    6666    void save(){ 
    67         (new File(this.path)).write(this.data); 
     67        (new File(this.path.toString)).write(this.data); 
    6868    } 
    6969