Commit Graph

9538 Commits

Author SHA1 Message Date
Yawning Angel
ecee0e2db2 repo: Add more test binaries to .gitignore 2024-01-07 20:04:40 +09:00
Jeroen van Rijn
2784e8ea51 Merge pull request #3072 from laytan/add-dynlib-last_error
dynlib: add last_error procedure
2024-01-06 02:13:53 +01:00
Laytan Laats
85b71708dd dynlib: add last_error procedure 2024-01-06 02:08:11 +01:00
Jeroen van Rijn
649b5fa528 Add bool return to dynlib.initialize_symbols. 2024-01-06 02:04:09 +01:00
Jeroen van Rijn
d6a89d667d Add dynlib.initialize_symbols (#3071)
```
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^)
	}
}
```
2024-01-06 01:31:27 +01:00
gingerBill
b408ec6bac Remove distinct from the specific types 2024-01-05 14:48:39 +00:00
gingerBill
8545f316ff Fix the type inference in builtin.quaternion 2024-01-05 14:45:03 +00:00
gingerBill
3bf7b416e7 Fix builtin.quaternion generation 2024-01-05 14:36:58 +00:00
gingerBill
0b83e3dae5 Enforce naming the parameters with builtin.quaternion to reduce confusion 2024-01-05 14:29:14 +00:00
gingerBill
d7d23e65ea Clean up error block usage 2024-01-05 13:47:00 +00:00
gingerBill
2820bbc269 Add @(entry_point_only) for procedures 2024-01-05 13:38:30 +00:00
gingerBill
70c5153471 Merge branch 'master' of https://github.com/odin-lang/Odin 2024-01-03 21:00:35 +00:00
gingerBill
5961d4b316 Merge pull request #2983 from perogycook/raylib5
Raylib5 bindings with fixes
dev-2024-01
2024-01-03 18:32:45 +00:00
Jeroen van Rijn
b59c80d6fd Merge pull request #3068 from laytan/json-unmarshal-union
encoding/json: try to unmarshal into union variants
2024-01-03 19:13:36 +01:00
Laytan Laats
8c10f4cdde encoding/json: try to unmarshal into union variants 2024-01-03 19:02:30 +01:00
gingerBill
0cc72b536f Merge pull request #3066 from laytan/darwin-actually-honor-no-crt
darwin: actually honor no-crt by not linking with `-lSystem -lm`
2024-01-03 17:25:41 +00:00
Laytan Laats
8a7c2ea9d0 darwin: actually honor no-crt by not linking with -lSystem -lm 2024-01-02 21:44:51 +01:00
Jeroen van Rijn
cb1c10ce83 Merge pull request #3067 from Platin21/fix/macos-no-duplicated-linkage
Fix/macos no duplicated linkage
2024-01-02 21:35:41 +01:00
Platin21
37c2e9bec3 Fixed Typo / Added check for 1 2024-01-02 21:14:17 +01:00
Platin21
4626cd03da Adds missing space 2024-01-02 21:04:44 +01:00
Platin21
3850be2e11 Fixed git issue.. 2024-01-02 21:04:03 +01:00
Platin21
4c9aa30a1e Merge remote-tracking branch 'origin/master' into fix/macos-min-version 2024-01-02 20:55:20 +01:00
Platin21
da977cf1e6 Adds new flag for linker to know if it should link the system library or not 2024-01-02 20:55:15 +01:00
Jeroen van Rijn
ee97c5958f Merge pull request #3065 from Platin21/fix/macos-min-version
Removes macOS min version and supports default latest
2024-01-02 20:07:26 +01:00
Platin21
778bbee17c Removes macOS min version and supports default latest 2024-01-02 19:49:44 +01:00
Jeroen van Rijn
4efef08c94 Update core:encoding to Unicode 15.1 table. 2024-01-02 18:03:32 +01:00
gingerBill
87c835268a Merge pull request #2917 from flysand7/sys-linux-additions
[sys/linux]: Fixes and additions
2024-01-02 14:23:40 +00:00
gingerBill
83ed0b37cd Merge pull request #3036 from laytan/error-when-c-vararg-is-not-on-last-param
error when #c_vararg is not applied to the last parameter
2024-01-02 14:22:24 +00:00
gingerBill
dc49cf766f Merge pull request #3048 from ThomasL81/master
Fixing a pdb linker error when the path contains spaces
2024-01-02 14:18:44 +00:00
gingerBill
933754193a Merge pull request #3049 from igordreher/dxgi_bit_set
[vendor:directx/dxgi] change u32 flags to bit_sets
2024-01-02 14:18:09 +00:00
gingerBill
76eef47491 Merge pull request #3054 from igordreher/win_error
[core:sys/windows] add System Error Codes enum
2024-01-02 14:16:36 +00:00
gingerBill
0e21f45076 Merge pull request #3057 from korvahkh/fix-nil-default-arg
Fix #3056
2024-01-02 14:14:35 +00:00
gingerBill
9bfe3a94f4 Merge pull request #3061 from flysand7/glfw-set-joystick-callback-fix
Fix the declaration of SetJoystickCallback
2024-01-02 14:13:53 +00:00
gingerBill
a2009220a2 Merge pull request #3063 from aragalie/patch-1
remove duplication
2024-01-02 14:13:42 +00:00
gingerBill
b410383aaf Merge branch 'master' of https://github.com/odin-lang/Odin 2024-01-01 16:11:13 +00:00
Alex Ragalie
b47736260a remove duplication 2023-12-31 21:57:39 +01:00
flysand7
5154bb551a Fix the declaration of glfwSetJoystickCallback 2023-12-31 15:03:50 +11:00
Jeroen van Rijn
89084befb0 Remove unnecessary []byte -> []byte conversion. 2023-12-30 21:59:33 +01:00
gingerBill
f3caa4aee3 Add bin/lld-link.exe 2023-12-30 13:53:15 +00:00
gingerBill
3ec253f385 Add bin/wasm-ld.exe 2023-12-30 13:52:37 +00:00
korvahkh
759e342872 Fix #3056 2023-12-29 22:39:34 -06:00
Igor Dreher
120b1101fb [core:sys/windows] add System Error Codes enum
Copied error values from https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
and subsequent pages to an enum
2023-12-29 11:06:50 -03:00
Jeroen van Rijn
252fd0e928 Merge pull request #3052 from laytan/fix-type-assign-at
fix typo in assign_at_elems
2023-12-28 17:44:20 +01:00
Laytan Laats
1fa2af213d fix typo in assign_at_elems 2023-12-28 17:10:08 +01:00
Igor Dreher
de84db85cb [vendor:directx/dxgi] change u32 flags to bit_sets 2023-12-28 09:42:37 -03:00
Jeroen van Rijn
33d85adf34 Merge pull request #3051 from laytan/fix-double-execution-of-tests
fix double execution of tests
2023-12-27 15:58:19 +01:00
Laytan Laats
383d485e2a fix double execution of tests 2023-12-27 15:34:11 +01:00
Jeroen van Rijn
68d2b7bb89 Disable doc tests for now. 2023-12-27 15:29:40 +01:00
Jeroen van Rijn
d667809e0a Merge pull request #3050 from laytan/fix-load-directive-with-absolute-paths
fix load directive with absolute paths
2023-12-27 15:21:43 +01:00
Laytan Laats
64ed4389ff fix load directive with absolute paths 2023-12-27 15:00:33 +01:00