Welcome to LQ.
The default functions :
They are all compiled into the executable 'ns'.
That includes the c++ functions,
and files in ns-2.34/tcl/lib/ , etc. tcl/<folders>.
So normally you would add a new function to e.g. :
tcl/{ ns-default.tcl, ns-lib.tcl, ns-mobilenode.tcl, ns-packet.tcl }.
... And compile everything new into a new "ns-new".
I.e. make a backup of the current 'ns' : $ cp ns ns-orig
Then : $ make clean && make
----
There are ways of using c++ in tcl :
( I have never seen anybody using it in ns2 )
http://www.linuxquestions.org/questi...9/#post4094259
<
http://www.linuxquestions.org/questi...ines-813129/#7
http://wiki.tcl.tk/1491
C++
http://cpptcl.sourceforge.net/doc/quickstart.html
http://wiki.tcl.tk/13040
http://cpptcl.sourceforge.net/
----