[Click] element_provides and element_requires
Nele Gheysens
nele.gheysens at intec.ugent.be
Fri Jul 6 03:55:05 EDT 2007
Hi,
Thank you for your help. Peter, I am not sure if my problems have
anything to do with the use of hashmaps, because I used maps before
without a problem.
Eddie, you asked my which linker errors appeared. But I cannot reproduce
these linker errors anymore after performing a make distclean. But now I
have some other problems. This is my code:
End of file trains_tcb.cc:
#include <click/bighashmap.cc>
#include <click/vector.cc>
CLICK_ENDDECLS
ELEMENT_PROVIDES(sctp_Trains_TCB)
ELEMENT_REQUIRES(sctp_Trains_Timer)
ELEMENT_REQUIRES(sctp_Trains_Link)
End of file trains_CDM.cc:
CLICK_ENDDECLS
ELEMENT_REQUIRES(sctp_Trains_TCB)
ELEMENT_REQUIRES(sctp_Trains_Timer )
ELEMENT_REQUIRES(sctp_Trains_Link)
EXPORT_ELEMENT(Trains_CDM)
When I compile this, I get the following error:
../elements/local/trains/trains_CDM.cc:98: error:
`get_databuffer_length' undeclared (first use this function)
(and so on for some other functions)
where get_databuffer_length() (and the other functions the compiler is
complaining about) is a funcion provided bij trains_tcb.cc.
If I put a mistake in de file trains_tcb.cc or trains_tcb.hh, the
compiler doesn't complain. So I believe that this file isn't compiled.
But I don't understand why.
Nele
Peter De Cleyn wrote:
> Hi Nele,
>
>
> Im' not sure if you are trying to use map structures in Click
> elements, but if so I think it is better to use the implementations
> provided in Click itself. In one of the elements we created, I needed
> to include the cc (!!) file of the bighashmap at the end in order to
> get things working and provided the necessary ELEMENT_PROVIDES
> statements.
>
> So to be clear: file1.cc and file1.hh define some functionallity
> (using a map), but do not define an element. element1.cc and
> element1.hh do define an element and need to use the functionality of
> file1.
>
> element1.hh includes file1.hh
>
> and
>
> ---------------------------------------------------
> last lines of file1.cc using bighasmap
> ---------------------------------------------------
>
> #include <click/bighashmap.cc>
>
>
> CLICK_ENDDECLS
>
> ELEMENT_PROVIDES(MIP_BINDING_TABLE)
>
> ELEMENT_REQUIRES(MIP_BINDING);
>
>
> ---------------------------------------------------------------------
> last lines of element1.cc using file1
> ---------------------------------------------------------------------
>
> #include <click/bighashmap.cc>
>
>
> CLICK_ENDDECLS
>
> ELEMENT_REQUIRES(MIP_BINDING_TABLE)
>
> ELEMENT_REQUIRES(MIP_BINDING)
>
> ELEMENT_REQUIRES(MIP_FA_BINDING)
>
> EXPORT_ELEMENT(ForeignAgent)
>
>
> -----------------------------------------------
>
>
> Remark, file1 itselfs requires functionality from a second
> non-element. So you can generalise the use of the
> ELEMENT_REQUIRE/ELEMENT_PROVIDE macros, but I added the REQUIRES again
> in the element file. I don't know if this was necessary, but it works ;-)
>
>
> Hope this is helpful to you,
>
>
> Peter De Cleyn
>
>
> Universiteit Antwerpen
> Departement Wiskunde-Informatica
> Middelheimlaan 1
> 2020 Antwerpen
>
>
> On 7/2/07, *Nele Gheysens* <nele.gheysens at intec.ugent.be
> <mailto:nele.gheysens at intec.ugent.be>> wrote:
>
> Hello,
>
> I tried to apply the following FAQ from the trains website:
>
> /How can I make Click compile a C++ file that doesn't contain an
> element?
> Add an ELEMENT_PROVIDES statement to your .cc file. The Click build
> process searches for C and C++ files with 'ELEMENT_PROVIDES' as
> well as
> 'EXPORT_ELEMENT'. You'll have to come up with a one-word tag
> describing
> the functionality that your .cc file provides. See the end of
> 'elements/userlevel/fakepcap.cc' for an example; it looks like this:
> ...
> CLICK_ENDDECLS
> ELEMENT_REQUIRES(userlevel|ns)
> ELEMENT_PROVIDES(FakePcap)
> Elements that use the 'FakePcap' functionality explicitly require it
> with ELEMENT_REQUIRES; see 'elements/userlevel/fromdump.cc' for an
> example./
>
>
> I followed this example, but I get a whole bunch of linker errors.
> Does
> anyone have some experience with this?
> The files on which I tried this used to be the include and lib map
> and
> they didn't cause any problems.
>
> Thanks,
>
> Nele Gheysens
>
> --
> Nele Gheysens
> Ghent University - IBCN
> Department of Information Technology
> Gaston Crommenlaan 8 bus 201
> 9050 Gent, Belgium
> E-mail: nele.gheysens at intec.UGent.be
> <mailto:nele.gheysens at intec.UGent.be>
> Tel. +32 9 33 14981
> secr.: +32 (0) 9 33 14900
> fax : +32 (0) 9 33 14899
> WWW: http://www.ibcn.intec.UGent.be
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu <mailto:click at amsterdam.lcs.mit.edu>
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
>
--
Nele Gheysens
Ghent University - IBCN
Department of Information Technology
Gaston Crommenlaan 8 bus 201
9050 Gent, Belgium
E-mail: nele.gheysens at intec.UGent.be
Tel. +32 9 33 14981
secr.: +32 (0) 9 33 14900
fax : +32 (0) 9 33 14899
WWW: http://www.ibcn.intec.UGent.be
More information about the click
mailing list