[Click] element_provides and element_requires

Peter De Cleyn peter.decleyn at gmail.com
Thu Jul 5 03:21:31 EDT 2007


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> 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
> 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
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list