Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8300015

allow a size passed to java.lang.foreign.SymbolLookup.lookup

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      The size of the returned symbol is 0.
      In order to access the POSIX variable timezone of time.h one needs a extra conversation to MemoryAddress.

      MemorySegment timezone = SymbolLookup.lookup("timezone").get()
      timezone.address().get(ValueLayout.JAVA_LONG, 0)

      but having a size

      MemorySegment timezone = SymbolLookup.lookup("timezone", 8).get()
      timezone.get(ValueLayout.JAVA_LONG, 0)

      This would preserve the MemorySession of the SymbolLookup instance and eliminate the transformation to MemoryAddress.
      Storing only the MemoryAddress would complete eliminate the MemorySession, this could lead to other problems.


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: