• Alex Brainman's avatar
    syscall: delay load of dll functions until they are called · 9d7e3934
    Alex Brainman authored
    Before this change, syscall package would load
    all dlls used anywhere in the go tree on startup.
    For example, this program:
    
    package main
    
    import "fmt"
    
    func main() {
           fmt.Printf("Hello world\n")
    }
    
    would load these dlls
    
    kernel32.dll
    advapi32.dll
    shell32.dll
    wsock32.dll
    ws2_32.dll
    dnsapi.dll
    iphlpapi.dll
    
    Most of these dlls are network related and are not used
    in this program. Now the same program loads only
    
    kernel32.dll
    shell32.dll
    
    This decreases start times somewhat.
    
    This also relaxes the rules of which dlls can be included
    in the standard library. We could now include system calls
    that are not available on all versions of Windows, because
    we could decide if we should call them during runtime.
    
    R=rsc, vcc.163
    CC=golang-dev
    https://golang.org/cl/4815046
    9d7e3934
winapi.go 4.09 KB