diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-12-16 11:31:08 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-12-16 11:31:08 +0000 |
| commit | f5679832608c93e8ebc2004ffd92fbe174450a01 (patch) | |
| tree | f7f314d6305f9f92fb72a67db4afa1cff22aa3de /code | |
| parent | ad843141439fc101709dc234c289d5d6d4676aaf (diff) | |
Semicolons mandatory again (and probably forever now...)
Diffstat (limited to 'code')
| -rw-r--r-- | code/demo.odin | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/code/demo.odin b/code/demo.odin index 41bf9b40b..7b9cb6f12 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -1,55 +1,60 @@ -#import "win32.odin" -#import "fmt.odin" -#import "sync.odin" +#import win32 "sys/windows.odin"; +#import "fmt.odin"; +#import "sync.odin"; +#import "hash.odin"; +#import "math.odin"; +#import "mem.odin"; +#import "opengl.odin"; +#import "os.odin"; +#import "utf8.odin"; Dll :: struct { - Handle :: type rawptr - name: string - handle: Handle + Handle :: type rawptr; + name: string; + handle: Handle; } load_library :: proc(name: string) -> (Dll, bool) { - buf: [4096]byte - copy(buf[:], name as []byte) + buf: [4096]byte; + copy(buf[:], name as []byte); - lib := win32.LoadLibraryA(^buf[0]) + lib := win32.LoadLibraryA(^buf[0]); if lib == nil { - return nil, false + return nil, false; } - return Dll{name, lib as Dll.Handle}, true + return Dll{name, lib as Dll.Handle}, true; } free_library :: proc(dll: Dll) { - win32.FreeLibrary(dll.handle as win32.HMODULE) + win32.FreeLibrary(dll.handle as win32.HMODULE); } get_proc_address :: proc(dll: Dll, name: string) -> (rawptr, bool) { - buf: [4096]byte - copy(buf[:], name as []byte) + buf: [4096]byte; + copy(buf[:], name as []byte); - addr := win32.GetProcAddress(dll.handle as win32.HMODULE, ^buf[0]) as rawptr + addr := win32.GetProcAddress(dll.handle as win32.HMODULE, ^buf[0]) as rawptr; if addr == nil { - return nil, false + return nil, false; } - return addr, true + return addr, true; } main :: proc() { - lib, lib_ok := load_library("example.dll") + lib, lib_ok := load_library("example.dll"); if !lib_ok { - fmt.println("Could not load library") - return + fmt.println("Could not load library"); + return; } - defer free_library(lib) + defer free_library(lib); - - proc_addr, addr_ok := get_proc_address(lib, "some_thing") + proc_addr, addr_ok := get_proc_address(lib, "some_thing"); if !addr_ok { - fmt.println("Could not load 'some_thing'") - return + fmt.println("Could not load 'some_thing'"); + return; } - some_thing := (proc_addr as proc()) - some_thing() + some_thing := (proc_addr as proc()); + some_thing(); } |