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

Eddie Kohler kohler at cs.ucla.edu
Thu May 27 00:27:40 EDT 2004


Hi Paolo, sorry for the delay.

Paolo Pisati wrote:
>>> 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?

Unfortunately, you must modify the Makefile, at least for now.

> 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?

A good idea.  Thanks!

Eddie


More information about the click mailing list