Shaping C-like structs into memory segments – Foreign (Function) Memory API

146. Shaping C-like structs into memory segments Let’s consider the C-like struct from the following figure: Figure 7.12 – A C-like structure So, in Figure 7.12, we have a C-like ... Read MoreRead More

0 Comments

Allocating arrays into memory segments – Foreign (Function) Memory API

143. Allocating arrays into memory segments Now that we know how to create memory segments for storing single values let’s make a step further and let’s try to store an ... Read MoreRead More

0 Comments

Introducing PaddingLayout 2 – Foreign (Function) Memory API

Hooking size, alignment, stride, and padding Before continuing working with padding, we need to cover some notions which are closely related to each other and work hand in hand with ... Read MoreRead More

0 Comments

Introducing PaddingLayout – Foreign (Function) Memory API

148. Introducing PaddingLayout Data types are typically characterized by several properties: size, alignment, stride, padding, and order of bytes.Padding layout (java.lang.foreign.PaddingLayout) allows us to specify the padding. In other words, ... Read MoreRead More

0 Comments

Introducing slice handle – Foreign (Function) Memory API

151. Introducing slice handle Let’s suppose that we have the following nested model (10 sequences of 5 double values each): SequenceLayout innerSeq  = MemoryLayout.sequenceLayout(5, ValueLayout.JAVA_DOUBLE);SequenceLayout outerSeq  = MemoryLayout.sequenceLayout(10, innerSeq); Next, ... Read MoreRead More

0 Comments

Introducing layout reshaping – Foreign (Function) Memory API

153. Introducing layout reshaping Let’s suppose that we have the following nested model (the exact same model as in Problem 151): SequenceLayout innerSeq  = MemoryLayout.sequenceLayout(5, ValueLayout.JAVA_DOUBLE);SequenceLayout outerSeq  = MemoryLayout.sequenceLayout(10, innerSeq); ... Read MoreRead More

0 Comments

Introducing Foreign Linker API – Foreign (Function) Memory API

158. Introducing Foreign Linker API The main goal of Foreign Linker API is to provide a robust and easy-to-use API (no need to write C/C++ code) for sustaining interoperability between ... Read MoreRead More

0 Comments

Calling the sumTwoInt() foreign function – Foreign (Function) Memory API

159. Calling the sumTwoInt() foreign function Do you remember the sumTwoInt() function? We have defined this C function in a native shared library named math.dll (check Problems 137, 138, and ... Read MoreRead More

0 Comments

Tackling the slicing allocator – Foreign (Function) Memory API

150. Tackling the slicing allocator Let’s consider the following three Java regular int arrays: int[] arr1 = new int[]{1, 2, 3, 4, 5, 6};int[] arr2 = new int[]{7, 8, 9};int[] ... Read MoreRead More

0 Comments

Closing the electrical panel before JDK 17 2 – Sealed and Hidden Classes

Declaring classes/interfaces as non-public Going further, we can declare interfaces/classes as non-public (by skipping the public keyword from the class/interface definition it becomes non-public and is set by default in ... Read MoreRead More

0 Comments