[Click] Adding a thin C++ wrapper node to Click

Paolo Pisati paolo.pisati at iit.cnr.it
Tue May 4 11:21:22 EDT 2004


On Mon, 03 May 2004 22:30:02 -0700, Eddie Kohler <kohler at cs.ucla.edu>  
wrote:

>>  Hi Clickers,
>>  I think the subject says it all.
>
> Well, I'm glad you got a bit more specific :)

  =)

>>  Let's assume that i wrote a correct node, the only remainig problem is  
>> the  building process, so
>> here come the questions:
>>  is there a standard way to add any code to Click?
>
> Yes; see the FAQ, Section 3, or look in etc/samplepackage.

I knew i had to RTFM before asking any questions... apologies... =P

>> Should i modify/tweak any Makefiles and/or any particular options?
>
> See the FAQ again.  If you add an element to elements/local (and  
> configure with --enable-local), you should not need to tweak Makefiles,  
> as long as your source files are decorated with EXPORT_ELEMENT() as  
> required.

well, actually in my situation the question still holds cause
i've to link some objs (from the C project) against my
C++ node (that i moved to elements/local now).
Now the building process compiles
my c++ wrapper but stops at linking stage(obviously).
Is there a legal way (other than modify the Makefile in userlevel) to add
arbitrary objs to the linking phase?

for the sake ot correctness, i've to say that modifying the Makefile and  
manually
adding my c++/objs to the building process i managed to make it works, but
i prefer to follow the "right path", at least if there's one.

>> And last but not least, is there a particular procedure to follow  
>> mixing C  and C++ code?
>
> You may be able to do this automatically with an ELEMENT_PROVIDES()  
> decoration on the C file (if you put the C file under elements/local or  
> whatever).  See elements/etherswitch/bridgemessage.cc for an example of  
> ELEMENT_PROVIDES().

i managed this with a couple of 'extern "C" blablabla' at the beginning of
my node, and then linking together the objs:

probably not the smartest solution in the world, but it worked... =)

> Hope this helps!
> Eddie

may i suggest to add the FAQ manual to the website?

bye bye

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


More information about the click mailing list