[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linkage betwen Otcl and C++ code



Hello everybody,
   I'm very desesperate.
I'm using ns 2.1b5.
I can't  execute the linkage between the C++ code and Tcl code.

This is an example.

//----------The C++, code------------------------------------------
#include "agent.h"
#include <stdio.h>
#include "packet.h"
#include "tclcl.h"
//#include "address.h"
//#include "ip.h"

class prova : public Agent {
public:
	prova();
};


//---------------------------------
static class provaClass : public TclClass {
public:
	provaClass() : TclClass("Agent/prova") {}
	TclObject* create(int, const char*const*) {
		return (new prova());
	}
} class_prova;
//---------------------------------

prova::prova() : Agent(PT_NTYPE)
{ 
    printf("@@@@@@@ I am here");
}



#---------------------------------------------
#this is the tcl script:

set ns [new Simulator]
set x  [new Agent/prova]
exit 1
#-----------

Why NS can't istantiate my new class.
Help me please
Thanks in advance
             Luca Liberti