Can I get the value of the global variable defined in some module (JITing)

Hello, everyone!

I need to define the global variable which would be modified by JITted
code. Can I read it from the JITter itself? It is of pointer type.

Best regards,
Milovanov Victor.

Hi,

I need to define the global variable which would be modified by JITted
code. Can I read it from the JITter itself? It is of pointer type.

I'm not sure what you are asking, can you please be more explicit/detailed.

Ciao, Duncan.

Ok, another explanation. In my runtime that uses LLVM as JIT engine, I
have an instnace of GlobalVariable. The program I run in it writes
some value to this variable. How can I read it?

Two possibilities:

1. Define the global as external in your IR, and use
ExecutionEngine::addGlobalMapping to link it to the address that your
host is writing to. Be sure to use volatile reads, and use a volatile
pointer/global variable in your host.
2. Define the global variable as a normal global variable, and use
ExecutionEngine::getPointerToGlobal to get a pointer to it from the
JIT engine, and use that pointer in your host to write to the
variable. Again, use volatile reads in IR and a volatile pointer in
your host.