[Tinyos-help] URGENT: NesC renames all internal functions?!

2012-01-10 Thread Anna Förster
Hi all,

I am trying to implement a tinyos interface to a software library. The problem 
I am currently facing is that the NesC compiler re-names all functions like 
this:

in BlinkC.nc I define for example MY_FUNCTION
And then it is converted to BLINKC_MY_FUNCTION

Well, what I am actually trying to do is the following simple scenario:

An external C file uses an interface function, which needs to be defined in 
Tinyos, let's say interface_function(). To compile the C file, I have defined a 
INTERFACE.H file, where I only declare the function, but do not impelment it. 
Then, in the tinyos code, I want to implement it by putting exactly this 
fucntion into the implementation of the TinyOS component.

What happens is that the linker cannot find the implementation of this 
fucntion, because NesC has renamed its implementation to 
BlinkC__interface_function().

Any ideas of how to handle this?! Any other possibilities of how to implement a 
tinyos function and call it from an external file?

Thanks a lot,
Anna
--
Dr. Anna Förster
PostDoctoral Researcher
Networking Laboratory, SUPSI
Via Cantonale, Galleria 2
Manno, Switzerland
Tel. + 41 58 666 6597
http://www.dti.supsi.ch/~afoerste/


___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] URGENT: NesC renames all internal functions?!

2012-01-10 Thread Michael Schippling
Search this list and the doc site http://docs.tinyos.net/
for advice on calling C functions and libraries from TOS.
That's the opposite of what you want, but you may find
something in the various described approaches for getting
around the name mangling.

MS

Anna Förster wrote:
> Hi all,
> 
> I am trying to implement a tinyos interface to a software library. The 
> problem I am currently facing is that the NesC compiler re-names all 
> functions like this:
> 
> in BlinkC.nc I define for example MY_FUNCTION
> And then it is converted to BLINKC_MY_FUNCTION
> 
> Well, what I am actually trying to do is the following simple scenario:
> 
> An external C file uses an interface function, which needs to be defined in 
> Tinyos, let's say interface_function(). To compile the C file, I have defined 
> a INTERFACE.H file, where I only declare the function, but do not impelment 
> it. Then, in the tinyos code, I want to implement it by putting exactly this 
> fucntion into the implementation of the TinyOS component.
> 
> What happens is that the linker cannot find the implementation of this 
> fucntion, because NesC has renamed its implementation to 
> BlinkC__interface_function().
> 
> Any ideas of how to handle this?! Any other possibilities of how to implement 
> a tinyos function and call it from an external file?
> 
> Thanks a lot,
> Anna
> --
> Dr. Anna Förster
> PostDoctoral Researcher
> Networking Laboratory, SUPSI
> Via Cantonale, Galleria 2
> Manno, Switzerland
> Tel. + 41 58 666 6597
> http://www.dti.supsi.ch/~afoerste/
> 
> 
> ___
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] URGENT: NesC renames all internal functions?!

2012-01-10 Thread Eric Decker
Only definitions that are inside an implementation block actually have name
mangling occur.

So if you pull the function outside (or the forward reference definition
outside) then it won't be mangled and it should then work as you desire.

But do follow Michael's advise, you should be able to do reasonable mailing
list searching at mail-archive.com.

eric


2012/1/10 Anna Förster 

> Hi all,
>
> I am trying to implement a tinyos interface to a software library. The
> problem I am currently facing is that the NesC compiler re-names all
> functions like this:
>
> in BlinkC.nc I define for example MY_FUNCTION
> And then it is converted to BLINKC_MY_FUNCTION
>
> Well, what I am actually trying to do is the following simple scenario:
>
> An external C file uses an interface function, which needs to be defined
> in Tinyos, let's say interface_function(). To compile the C file, I have
> defined a INTERFACE.H file, where I only declare the function, but do not
> impelment it. Then, in the tinyos code, I want to implement it by putting
> exactly this fucntion into the implementation of the TinyOS component.
>
> What happens is that the linker cannot find the implementation of this
> fucntion, because NesC has renamed its implementation to
> BlinkC__interface_function().
>
> Any ideas of how to handle this?! Any other possibilities of how to
> implement a tinyos function and call it from an external file?
>
> Thanks a lot,
> Anna
> --
> Dr. Anna Förster
> PostDoctoral Researcher
> Networking Laboratory, SUPSI
> Via Cantonale, Galleria 2
> Manno, Switzerland
> Tel. + 41 58 666 6597
> http://www.dti.supsi.ch/~afoerste/
>
>
> ___
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Eric B. Decker
Senior (over 50 :-) Researcher
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] URGENT: NesC renames all internal functions?!

2012-01-10 Thread Johny Mattsson
Hello Anna,

You can use nesC annotations to prevent the name mangling. Have a look at
section 11 in the nesC 1.3 language reference manual. The first two are the
ones which apply to your situation. Depending on the exact use case you may
or may not need the second one. If you don't need it, then Eric's
suggestion of simply putting the definition outside the implementation
block should work just as well.

Regards,
/Johny


2012/1/11 Anna Förster 

> Hi all,
>
> I am trying to implement a tinyos interface to a software library. The
> problem I am currently facing is that the NesC compiler re-names all
> functions like this:
>
> in BlinkC.nc I define for example MY_FUNCTION
> And then it is converted to BLINKC_MY_FUNCTION
>
> Well, what I am actually trying to do is the following simple scenario:
>
> An external C file uses an interface function, which needs to be defined
> in Tinyos, let's say interface_function(). To compile the C file, I have
> defined a INTERFACE.H file, where I only declare the function, but do not
> impelment it. Then, in the tinyos code, I want to implement it by putting
> exactly this fucntion into the implementation of the TinyOS component.
>
> What happens is that the linker cannot find the implementation of this
> fucntion, because NesC has renamed its implementation to
> BlinkC__interface_function().
>
> Any ideas of how to handle this?! Any other possibilities of how to
> implement a tinyos function and call it from an external file?
>
> Thanks a lot,
> Anna
> --
> Dr. Anna Förster
> PostDoctoral Researcher
> Networking Laboratory, SUPSI
> Via Cantonale, Galleria 2
> Manno, Switzerland
> Tel. + 41 58 666 6597
> http://www.dti.supsi.ch/~afoerste/
>
>
> ___
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Johny Mattsson
Senior Software Engineer

DiUS Computing Pty. Ltd.
*where ideas are engineered
*
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] URGENT: NesC renames all internal functions?!

2012-01-10 Thread Eric Decker
Cool.  Thanks Johny.   learn something everyday.

I went and stared at section 11 to see what Johny was talking about and you
should be able to use the '@C' attribute notation.

eric


2012/1/10 Johny Mattsson 

> Hello Anna,
>
> You can use nesC annotations to prevent the name mangling. Have a look at
> section 11 in the nesC 1.3 language reference manual. The first two are the
> ones which apply to your situation. Depending on the exact use case you may
> or may not need the second one. If you don't need it, then Eric's
> suggestion of simply putting the definition outside the implementation
> block should work just as well.
>
> Regards,
> /Johny
>
>
> 2012/1/11 Anna Förster 
>
>> Hi all,
>>
>> I am trying to implement a tinyos interface to a software library. The
>> problem I am currently facing is that the NesC compiler re-names all
>> functions like this:
>>
>> in BlinkC.nc I define for example MY_FUNCTION
>> And then it is converted to BLINKC_MY_FUNCTION
>>
>> Well, what I am actually trying to do is the following simple scenario:
>>
>> An external C file uses an interface function, which needs to be defined
>> in Tinyos, let's say interface_function(). To compile the C file, I have
>> defined a INTERFACE.H file, where I only declare the function, but do not
>> impelment it. Then, in the tinyos code, I want to implement it by putting
>> exactly this fucntion into the implementation of the TinyOS component.
>>
>> What happens is that the linker cannot find the implementation of this
>> fucntion, because NesC has renamed its implementation to
>> BlinkC__interface_function().
>>
>> Any ideas of how to handle this?! Any other possibilities of how to
>> implement a tinyos function and call it from an external file?
>>
>> Thanks a lot,
>> Anna
>> --
>> Dr. Anna Förster
>> PostDoctoral Researcher
>> Networking Laboratory, SUPSI
>> Via Cantonale, Galleria 2
>> Manno, Switzerland
>> Tel. + 41 58 666 6597
>> http://www.dti.supsi.ch/~afoerste/
>>
>>
>> ___
>> Tinyos-help mailing list
>> Tinyos-help@millennium.berkeley.edu
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>
>
>
>
> --
> Johny Mattsson
> Senior Software Engineer
>
> DiUS Computing Pty. Ltd.
> *where ideas are engineered
> *
>
> ___
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Eric B. Decker
Senior (over 50 :-) Researcher
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help