Hi, how did you manage to load a library from disk?
val heic = "image1.heic"
val PATH = "libheif.dylib"
Arena.ofShared().use { arena ->
System.load(PATH)
val loaderLookup = SymbolLookup.loaderLookup()
val defaultLookup = linker.defaultLookup()
val lookup = SymbolLookup { loaderLookup.find(it).or { defaultLookup.find(it) } }
val poiterOnFile = arena.allocateFrom(heic)
val heifContextAlloc = lookup.find("heif_context_alloc").getOrNull() as MemorySegment
val handleHeifContextAlloc = linker.downcallHandle(heifContextAlloc, FunctionDescriptor.of(ADDRESS))
val pointerHeifContextAlloc = handleHeifContextAlloc.invokeExact() as MemorySegment
println(pointerHeifContextAlloc)
I am trying to understand, but my memory segment is empty.
MemorySegment{ address: 0x600002c2a190, byteSize: 0 }
Hi, how did you manage to load a library from disk?
I am trying to understand, but my memory segment is empty.