Add function to get the segment from a static variable
This commit is contained in:
parent
3794ab7d5f
commit
20956f2549
2 changed files with 11 additions and 0 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
|
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- New function to allow getting the backing memory segment of a `coffi.ffi.StaticVariable`, to replace the `Addressable` implementation lost in the migration to JDK 18
|
||||||
|
|
||||||
## [0.5.357] - 2022-07-07
|
## [0.5.357] - 2022-07-07
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
FunctionDescriptor
|
FunctionDescriptor
|
||||||
MemoryAddress
|
MemoryAddress
|
||||||
MemoryLayout
|
MemoryLayout
|
||||||
|
MemorySegment
|
||||||
NativeSymbol
|
NativeSymbol
|
||||||
SegmentAllocator)))
|
SegmentAllocator)))
|
||||||
|
|
||||||
|
|
@ -594,6 +595,14 @@
|
||||||
[static-var f & args]
|
[static-var f & args]
|
||||||
(freset! static-var (apply f @static-var args)))
|
(freset! static-var (apply f @static-var args)))
|
||||||
|
|
||||||
|
(defn static-variable-segment
|
||||||
|
"Gets the backing [[MemorySegment]] from `static-var`.
|
||||||
|
|
||||||
|
This is primarily useful when you need to pass the static variable's address
|
||||||
|
to a native function which takes an [[Addressable]]."
|
||||||
|
^MemorySegment [static-var]
|
||||||
|
(.-seg ^StaticVariable static-var))
|
||||||
|
|
||||||
(defn static-variable
|
(defn static-variable
|
||||||
"Constructs a reference to a mutable value stored in `symbol-or-addr`.
|
"Constructs a reference to a mutable value stored in `symbol-or-addr`.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue