Questions tagged [function-address]

10 questions
2
votes
1 answer

Why the function address is different before and after I run the code?

the source code is here #include int gcd(a, b) { if (b == 0) return a; return gcd(b, a % b); } int main(int argc, char **argv) { int a = atoi(argv[1]); int b = atoi(argv[2]); int res = gcd(a, b); printf("%d\n", res); return…
Ca Chen
  • 63
  • 8
2
votes
0 answers

How to get line number by function offset address from dumps

I was using kasan first time and got error of following type ================================================================== BUG: AddressSanitizer: out of bounds access in kmalloc_oob_right+0x65/0x75 [test_kasan] at addr ffff8800693bc5d3 Write of…
hdk
  • 21
  • 4
1
vote
3 answers

Odd behavior on printing function addresses in Python

I write the following code in Python: def fib(n): a, b = 0, 1 while b < n: print(b, end=' ') a, b = b, a + b print(fib, fib(10)) I think the correct output should be: 1 1 2 3 5 8 But…
Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137
1
vote
2 answers

How to get a function address from current executable?

I need to know the function address from current executable on Solaris 10 using C++ (I'm using GNU g++ 4.9.2). For example, I have a function say as: void doSomething(const char *p), that may or may not get defined in current executable. So, I would…
Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69
1
vote
2 answers

Function addresses consistant?

This is using the C langauge with VC++ 2010 on windows 7 64 bit. Is there a way to reliably and consistently access the address of a function (c linkage) so that it's the same address on every run of your program?
Tom Tetlaw
  • 83
  • 1
  • 10
  • 21
1
vote
1 answer

How to call exported function from dll in C/C++?

My aim is to call some function via its address. How can I do it? I have done the next work for such aim, but at first(1) - I've got access violation ( don't know why ) and with the second I have some problems with calling function is ASM with ESP…
Secret
  • 2,627
  • 7
  • 32
  • 46
0
votes
1 answer

a value of type"bool *" cannot be assigned to an entity of type "bool (*)(int enemy_piece)"

I cannot declare a address to the function pointer that I created earlier and I cannot understand what am i doing wrong. I declared function pointer to the function that returns a bool and takes 1 integer argument. Depending on the case, function…
kims9
  • 45
  • 1
  • 4
0
votes
1 answer

Wrong function address

Here’s the code: __declspec ( naked ) void nseel_asm_assign(void) { __asm { fld qword ptr [eax] fstp qword ptr [ebx] } } __declspec ( naked ) void nseel_asm_assign_end(void) {} The code that consumes them crashes. The debugger shows…
Soonts
  • 20,079
  • 9
  • 57
  • 130
0
votes
1 answer

confused with address of function in c

i am confused! are all of the following printf's the correct way to print the addresses of functions? Let me tell you my confusion as well. Everytime i run all of these printf's (that is, 1st printf, 2nd printf and 3rd printf), in output i…
gj1103
  • 127
  • 2
  • 10
0
votes
1 answer

finding variable and function memory addresses in shell

In shell programming, is there any way to find the variable and function addresses? Something like in c or c++ when we output the &x, we can get x memory address.