Re: Native and global variables

Thomas Chenot <tom.chenot-6tN4nzCoH/[email protected]> Tue, 22 Jun 2004 09:25:27 -0500
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Odd Arild Olsen wrote:

>As far as I have understood, native methods can not use global variables.
>I need a few global variables for my native library that will be persistent 
>over  library calls.
>
>Is there any practical way to do this, e. g. 
>
>by malloc 
>
Yes.

>or ephemeral state blocks? 
>
Yes.

>Even though I can malloc some memory, how can I make the pointer to 
>the memory available
>
The state block can hold the pointer returned from malloc.

You can also use indirects as described in the docs and native example. 
You can even DB variables in your native code segment.

> to the library functions without having to pass it as a 
>function call parameter.
>
>I use  sdcc compiler and tini1.02
>  
>
I have no SDCC experience but I'm pretty sure all of the above (with the 
possible exception of the DB option) can be done with the SDCC native 
interface.

>OAO
>
>  
>


-- 
Thomas Chenot

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini