Search code examples
ibm-doors

Can I set the value of a variable by using the address within DXL doors?


So what I want to do is pass a variable into an eval_ by address and then set the variable in there like so:

string str = "a"
Addr64_ addr = addr_ str
eval_("string ref = addr_ " addr "; ref = \"b\"")
print str // I want it to print b here

I realize I could evalTop_ here to make the top variable available to the eval so it can set it, but this is not the behavior that I am looking for.


Solution

  • So after a lot of debugging and combining different answers from the following sources:

    Memory hacks 1

    Memory hacks 2

    I found a solution! the following code should work for basically any variable:

    bool a = false
    eval_("bool &a = addr_ " (addr_ (&a)) "; a = true")
    
    print a // should print true