[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linkage betwen Otcl and C++ code
In your code, I did not see the linkage between Tcl and C++. Add the
following line to your Tcl code:
class Agent/prova -superclass Agent
Nader
Luca> Hello everybody,
Luca> I'm very desesperate.
Luca> I'm using ns 2.1b5.
Luca> I can't execute the linkage between the C++ code and Tcl code.
Luca>
Luca> This is an example.
Luca>
Luca> //----------The C++, code------------------------------------------
Luca> #include "agent.h"
Luca> #include <stdio.h>
Luca> #include "packet.h"
Luca> #include "tclcl.h"
Luca> //#include "address.h"
Luca> //#include "ip.h"
Luca>
Luca> class prova : public Agent {
Luca> public:
Luca> prova();
Luca> };
Luca>
Luca>
Luca> //---------------------------------
Luca> static class provaClass : public TclClass {
Luca> public:
Luca> provaClass() : TclClass("Agent/prova") {}
Luca> TclObject* create(int, const char*const*) {
Luca> return (new prova());
Luca> }
Luca> } class_prova;
Luca> //---------------------------------
Luca>
Luca> prova::prova() : Agent(PT_NTYPE)
Luca> {
Luca> printf("@@@@@@@ I am here");
Luca> }
Luca>
Luca>
Luca>
Luca> #---------------------------------------------
Luca> #this is the tcl script:
Luca>
Luca> set ns [new Simulator]
Luca> set x [new Agent/prova]
Luca> exit 1
Luca> #-----------
Luca>
Luca> Why NS can't istantiate my new class.
Luca> Help me please
Luca> Thanks in advance
Luca> Luca Liberti
Luca>
Luca>
Luca>
Luca>