Class JNAInterop


  • public class JNAInterop
    extends Object
    BridJ buffers interoperability
    Author:
    royer
    • Constructor Detail

      • JNAInterop

        public JNAInterop()
    • Method Detail

      • getJNAPointer

        public static com.sun.jna.Pointer getJNAPointer​(long pAddress)
        Gets JNA pointer given a native address. Important: there is no way to keep a reference of the parent object in a JNA Pointer. Holding the 'long' value of the pointer is no garantee that the corresponding buffer will not be deleted (opposite of malloc) if the holding object is garbage collected...
        Parameters:
        pAddress - address
        Returns:
        JNA pointer
      • getJNAPointer

        public static com.sun.jna.Pointer getJNAPointer​(ContiguousMemoryInterface pContiguousMemory)
        Returns a JNA Pointer Note: JNA memory have a BIG problem: the corresponding off-heap memory is not freed when garbage collected... are not freed when the It is a real problem.... So it is much better to allocate memory with CoreMem and then get a JNA pointer, instead of allocating on the JNA side...
        Parameters:
        pContiguousMemory - contiguous memory object
        Returns:
        JNA pointer