libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: structures


From: Michael Rolnik
Subject: Re: structures
Date: Tue, 26 Nov 2019 00:12:26 +0200

so for every field within the struct I will have to call jit_type_get_offset and then either jit_insn_load_relative or jit_insn_store_relative?

Thanks a lot.
Michael Rolnik

On Tue, Nov 26, 2019 at 12:00 AM Aleksey Demakov <address@hidden> wrote:
Hi Michael,

On Mon, Nov 25, 2019 at 4:24 PM Michael Rolnik <address@hidden> wrote:
> could you please explain or point me to a tutorial that explains how to use structures.
> I understand structure are create by  jit_type_create_struct function, but I could not find how to access struct members from within jit context and from host program.
>

The function jit_type_create_struct() defines a struct type. The
function jit_type_get_size() returns the size of the type. You can
allocate the required memory somewhere. Then to compile a code that
accesses a field of the struct you need to have a jit_value_t with the
struct address and then use jit_insn_load_relative() and
jit_insn_store_relative() functions together with
jit_type_get_offset().

Regards,
Aleksey


--
Best Regards,
Michael Rolnik

reply via email to

[Prev in Thread] Current Thread [Next in Thread]