Thank you, Raphael,

I have tested your solution, and it works.

On Thu, Mar 26, 2009 at 1:06 PM, Raphael Neider <[email protected]> wrote:
> Hi,
>
>>    static BYTE language=I18N_ES;
>>
>> inside of a header (temete4.h), which is included from all the 4
>> source files of the project: temete1.c, temete2.c, temete3.c &
>> temete4.c (you know, each one if for one page).
>>
>> The problem is that when I want to assign some value to "language" in
>> a function from, say, page 2 (temete2.c), then, if I call it from page
>> 3 (temete3.c), I'm getting a different value, as if there where 4
>> variables, one in each page, with the same name, but different
>> addresses.
>
> This is exactly what happens (and is supposed to happen using the static
> keyword on a global variable).
>
>> Any ideas on how to declare a unique global variable for all pages??
>
> As with every C compiler, having a declaration
>
> extern BYTE language;
>
> in temete4.h (to be included wherever language is accessed) and a matching
> definition
>
> BYTE language = I18N_ES;
>
> in exactly one .c file (which is linked to the project but not #include'd)
> should grant access to a shared variable across your .c files. Of course,

Yes, it does! :-)

> this will place language in exactly one of the memory banks of the PIC,
> requiring (automatically inserted) BANKSEL directives before access.
>
> There is no way to tell sdcc that a variable resides in a SHAREBANK so
> that accesses to it do not require BANKSELs. Even placing language in such
> a `bank' in some assembly source file would not help here.

I have talked to a collegue about this (he's the Electronic Engineer),
but we have yet no problems with it. I'm quite sure this will be
useful in some moment.

>
> Hope this clarifies things a bit,
> Raphael

Definitely, yes. Thank you Raphael,

cheers.

>
> ------------------------------------------------------------------------------
> _______________________________________________
> Sdcc-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>

------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to