| ??? 10/23/02 12:30 Read: times |
#31298 - RE: [C51]Problem \\\\\\\\ |
Try this:
in unit1.h: extern xdata char str1 [];This provides a declaration of str1 - it tells the Compiler what str1 is (an array of characters in XDATA) without actually creating any code or data; in unit1.c: #include "unit1.h" : xdata char str1 [8];This provides the definition of str1 - this is what actually creates the object in XDATA. Note that I have included "unit1.h" here - this allows the compiler to report an error if your declaration of str1 in the header does not match the definition in unit1.c in unit2.c: #include "unit1.h"
:
void func ( void )
{
int a;
a = atoi(str1);
}Here, we include the header file - rather than trying to re-type the declaration with the attendant risk of not (quite) matching the definition
(which is the root of your problems here). BTW: Note also the use of the and HTML tags to preserve the code formatting. |
| Topic | Author | Date |
| [C51]Problem "Ilegal pointer conversion" | 01/01/70 00:00 | |
| RE: [C51]Problem "Ilegal pointer convers | 01/01/70 00:00 | |
| RE: [C51]Problem steiner | 01/01/70 00:00 | |
| RE: [C51]Problem "Ilegal pointer conversion&q | 01/01/70 00:00 | |
| RE: [C51]Problem \\\\\\\\ | 01/01/70 00:00 | |
| RE: Code formatting in posts | 01/01/70 00:00 | |
| RE: Code formatting in posts - retry | 01/01/70 00:00 | |
| Erroneous External | 01/01/70 00:00 | |
| RE: [C51]Problem \ | 01/01/70 00:00 | |
| thanx Craig Steiner | 01/01/70 00:00 | |
RE: [C51]Problem "Ilegal pointer conversion&q | 01/01/70 00:00 |



