| Commit message (Collapse) | Author | Age | Files | Lines | |
|---|---|---|---|---|---|
| * | dynlib: fix initialize_symbols when there is no field for the handle in the ↵ | Laytan Laats | 2025-03-03 | 1 | -0/+5 |
| | | | | | struct | ||||
| * | dynlib: unload library before loading again & add LIBRARY_FILE_EXTENSION ↵ | Laytan Laats | 2024-11-28 | 1 | -13/+23 |
| | | | | | constant | ||||
| * | clean up dynlib and path/filepath with sys/posix | Laytan | 2024-10-28 | 1 | -5/+5 |
| | | |||||
| * | Remove implicit allocator usage in core:dynlib | Jeroen van Rijn | 2024-07-04 | 1 | -13/+5 |
| | | |||||
| * | Fix for dynlib:initialize_symbols not passing -vet-unused | Karl Zylinski | 2024-04-15 | 1 | -1/+1 |
| | | |||||
| * | Remove unneeded casts | gingerBill | 2024-02-06 | 1 | -2/+2 |
| | | |||||
| * | Clean up code for `initialize_symbols` | gingerBill | 2024-02-06 | 1 | -24/+17 |
| | | |||||
| * | Replace `core:*` to `base:*` where appropriate | gingerBill | 2024-01-28 | 1 | -2/+2 |
| | | |||||
| * | Add hot reload support to `dynlib.initialize_symbols` | Jeroen van Rijn | 2024-01-19 | 1 | -2/+10 |
| | | |||||
| * | dynlib: add last_error procedure | Laytan Laats | 2024-01-06 | 1 | -2/+17 |
| | | |||||
| * | Add bool return to `dynlib.initialize_symbols`. | Jeroen van Rijn | 2024-01-06 | 1 | -6/+5 |
| | | |||||
| * | Add `dynlib.initialize_symbols` (#3071) | Jeroen van Rijn | 2024-01-06 | 1 | -8/+84 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` package example import "core:dynlib" import "core:fmt" Symbols :: struct { // `foo_` is prefixed, so we look for the symbol `foo_add`. add: proc "c" (int, int) -> int, // We use the tag here to override the symbol to look for, namely `bar_sub`. sub: proc "c" (int, int) -> int `dynlib:"bar_sub"`, // Exported global (if exporting an i32, the type must be ^i32 because the symbol is a pointer to the export.) // If it's not a pointer or procedure type, we'll skip the struct field. hellope: ^i32, // Handle to free library. // We can have more than one of these so we can match symbols for more than one DLL with one struct. _my_lib_handle: dynlib.Library, } main :: proc() { sym: Symbols // Load symbols from `lib.dll` into Symbols struct. // Each struct field is prefixed with `foo_` before lookup in the DLL's symbol table. // The library's Handle (to unload) will be stored in `sym._my_lib_handle`. This way you can load multiple DLLs in one struct. count := dynlib.initialize_symbols(&sym, "lib.dll", "foo_", "_my_lib_handle") defer dynlib.unload_library(sym._my_lib_handle) fmt.printf("%v symbols loaded from lib.dll (%p).\n", count, sym._my_lib_handle) if count > 0 { fmt.println("42 + 42 =", sym.add(42, 42)) fmt.println("84 - 13 =", sym.sub(84, 13)) fmt.println("hellope =", sym.hellope^) } } ``` | ||||
| * | Document core:dynlib | Lucas Perlind | 2023-03-02 | 1 | -2/+81 |
| | | |||||
| * | Add `#optional_ok` to `dynlib.symbol_address` | gingerBill | 2022-05-25 | 1 | -1/+1 |
| | | |||||
| * | Make `core:dynlib` use the private interface convention of other packages | gingerBill | 2022-05-25 | 1 | -0/+12 |
| | | |||||
| * | Remove unneeded semicolons from the core library | gingerBill | 2021-08-31 | 1 | -1/+1 |
| | | |||||
| * | Remove `#opaque` usage in core library | gingerBill | 2021-02-23 | 1 | -1/+1 |
| | | |||||
| * | Deprecate `opaque` in favour of `#opaque` in the core library | gingerBill | 2020-12-04 | 1 | -1/+1 |
| | | |||||
| * | package dynlib | gingerBill | 2019-03-03 | 1 | -0/+3 |