[Tinyos-help] Call external function of C in nesC
Kevin Klues
klueska at gmail.com
Fri Sep 21 11:00:52 PDT 2007
You can also look at the PrintfP component in tos/lib/printf It has a
couple of these functions.
Kevin
On 9/21/07, Philip Levis <pal at cs.stanford.edu> wrote:
> On Sep 21, 2007, at 2:06 AM, Chan kenniel wrote:
>
> > Dear all,
> >
> > We are about to make a nesc program testing application. The
> > application will insert some functions into the source code so that
> > the running environment can be recorded. Something like:
> > source:
> > While (i)
> > {
> > ...
> > i++;
> > }
> > inserted:
> > while(i)
> > {
> > record(i) //inserted code
> > ...
> > i++
> > }
> > The problem comes that current record() is written by c. And when I
> > try to compile the inserted code, and error of implicit declaration
> > occurred. I am wondering if there is any way I can make my function
> > recognized by the compiler, just like those familiar functions such
> > as memcpy or printf, which can be recognized by nesc compiler?
> >
>
> Just like in C, make an include file. The trickier part is linking
> the function in. Take a look at the TinyOS programming manual's
> section on attributes on how to write a C function in a component.
> TOSSIM has a couple examples of doing this (writing a C function in a
> component so it is in the global C namespace rather than the
> component local namespace).
>
> Phil
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
~Kevin
More information about the Tinyos-help
mailing list