Skip to content

Commit 4ed36b9

Browse files
committed
feat(core): add Arena overload for lookupFunction and clean CHANGELOG
1 parent 104d59a commit 4ed36b9

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎docs/CHANGELOG.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1818
- **Hero Demo & Automation**:
1919
- Standalone runner `run-demo.bat` for quick verification.
2020
- Enhanced `Demo.java` testing both traditional JNI and Java 21+ FFM Linkers.
21-
- **Architectural Roadmap**:
22-
- Added hidden `.TODO.md` outlining the FastJava FFM migration path.
2321

2422
### Changed
2523
- Upgraded Java language baseline from 17 to **21 LTS** (`--enable-preview`).

‎src/main/java/fastcore/FastCore.java‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,21 @@ public static MethodHandle lookupFunction(String libraryName, String functionNam
229229
return lookupFunction(libraryName, functionName, descriptor, null, Arena.global());
230230
}
231231

232+
/**
233+
* Looks up and links an exported native C function using a custom arena and default classloader.
234+
*
235+
* @param libraryName Logical library name
236+
* @param functionName Exported C function symbol
237+
* @param descriptor Function signature descriptor
238+
* @param arena Custom arena scoping the symbol lookup
239+
* @return An invokable {@link MethodHandle}
240+
* @throws Exception If the library or symbol cannot be resolved
241+
*/
242+
public static MethodHandle lookupFunction(String libraryName, String functionName,
243+
FunctionDescriptor descriptor, Arena arena) throws Exception {
244+
return lookupFunction(libraryName, functionName, descriptor, null, arena);
245+
}
246+
232247
/**
233248
* Zero-overhead conversion of a 64-bit native memory address (e.g. from {@code FastPointer})
234249
* into an unbounded {@link MemorySegment}.

0 commit comments

Comments
 (0)