#170405 - Tommmie - Mon Sep 21, 2009 7:23 pm
Hey everyone,
I was executing this piece of code(it prints function pointers):
and I noticed that the offsets which were displayed are not correctly, almost but not correct:(I looked in the .map file for the real offsets):
real offsets:
func1: 0x0200037c
func2: 0x02000380
results of the program:
func1: 0x0200037D
func2: 0x02000381
but why are the addresses just 1 more? can someone explain it?
thanks,
Tommmie[/code]
I was executing this piece of code(it prints function pointers):
Code: |
#include <nds.h>
#include <stdio.h> int func1(int a) { return a; } char func2(char b) { return 'b'; } int main() { consoleDemoInit(); fp ptr1; int temp1; char temp2; ptr1 = (fp) func1; iprintf("pointer1 is: %d \n", (int)ptr1); temp1 = ((int (*)(int)) ptr1)(1); ptr1 = (fp) func2; iprintf("pointer2 is: %d \n", (int)ptr1); temp2 = ((char (*)(char))ptr1)('a'); printf("Received %d %c\n", temp1, temp2); return 0; } |
and I noticed that the offsets which were displayed are not correctly, almost but not correct:(I looked in the .map file for the real offsets):
real offsets:
func1: 0x0200037c
func2: 0x02000380
results of the program:
func1: 0x0200037D
func2: 0x02000381
but why are the addresses just 1 more? can someone explain it?
thanks,
Tommmie[/code]