[Tinyos-help] #include of header files for C functions

Cory Sharp cory at moteiv.com
Tue Jul 11 02:03:48 PDT 2006


Jay, don't bother with the .c file, just put the declaration and
definition all in the header.  This works because nesC just compiles
to one big app.c, so you don't get duplicate references.

Cory

On 7/10/06, Jay Taneja <taneja at cs.berkeley.edu> wrote:
> Hello,
>
> I am attempting to include a subroutine written in C. I've seen a couple
> posts on this list about this, but I would like to include the subroutine
> without writing a nesC wrapper. Currently I am simply following the way C
> includes files:
>
> mysub.h:
> #ifndef MYSUB_H
> #define MYSUB_H
> int mysub(int param);
> #endif
>
> mysub.c:
> #include "mysub.h"
> int mysub(int param) {
>   return param + 1;
> }
>
> ModuleM.nc
> #include " mysub.h"
> ...
> implementation {
>  ...
>     some_number_2 = mysub(some_number);
> ...
> }
>
> However, when I compile, I get an "undefined reference to `mysub'" - any
> idea of a clean way to fix this?
>
> Thanks.
>
> -jay
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>


More information about the Tinyos-help mailing list