[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question: Object files and Address extern variable
From: |
Sebastien DONADIO |
Subject: |
Question: Object files and Address extern variable |
Date: |
Thu, 21 Aug 2008 11:03:52 -0400 |
Hello,
I created a pragma to change the locality of data a in my code.
When I put "#pragma foo a" in file1.c and file2.c, I got the good result:
2.000000 0x80900850
But if it is only in file1.c, the result is
0.000000 0x0.
I'm using Binutils 2.18.
Which part of the code I need to modify?
But if it is only in file2.c
*********** file1.c ***********
#include <stdio.h>
#include <stdlib.h>
double *a;
#pragma foo a
int main(int argc, char*argv[])
{
a=(double *)calloc(1,sizeof(double));
*a=2;
address_a();
}
*********** file2.c ***********
#include <stdio.h>
extern double *a;
file2.c
void address_a() {
printf("%f %p\n",*a,a);
}
Thanks,
Sebastien
- Question: Object files and Address extern variable,
Sebastien DONADIO <=