RLPLite - using functions

Now when I managed to start working properly with the registers on Hydra (RLPLite), I have yet another question -

RLP example:


int func1()
{
     int func2Result = 0;

     func2Result = func2();

     func2Result  <<= 2;

     return(func2Result);
}

int func2()
{
     return(5);
}

Now here I would expect func2 return 5 to func1, which will shift left twice the result and then return 20 as the result of RLP action.
What I actually get is 5 as the return of RLP action. Looks like the return from func2 returns the whole RLP.

It looks like there’s no stack and return will not jump back to calling function and continue from where is was called, but it would just act as exit();

Is it expected??? Am i doing something wrong???

Thanks!

You’re not calling func2, you’re calling func() with 2 as argument

@ WouterH - I was going to point that out but know nothing about rlp so didn’t want to appear stupid :smiley:

@ Justin - it’s just plain C :slight_smile:

Fair enough…one day…

No I am not :slight_smile: Edited the original post. You are compilers or something?
Anyways, it was just an example I wrote here, no compiler to check spelling. Didn’t want to post actual code as it’s already too big and I wanted the code as simple as possible here.

Have you tested the simple code you posted here? I bet there’s an other problem which we can’t see here.

Yeah, it was my fault. I extracted some of the code from my main function to other function and didn’t noticed that main function was mapped to another address from now on. I’m surprised the code worked at all.
Anyways, I guess the case is solved…