From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,bc1296b3fed34d3,start X-Google-Attributes: gidfee84,public X-Google-Thread: 114387,bc1296b3fed34d3,start X-Google-Attributes: gid114387,public X-Google-Thread: 10ba33,bc1296b3fed34d3,start X-Google-Attributes: gid10ba33,public From: magrasjc@texas.net Subject: template separation Date: 1997/08/02 Message-ID: <33E38F0F.436E@texas.net> X-Deja-AN: 261775261 Organization: Texas Networking, Inc. Newsgroups: gnu.g++.help,comp.unix.osf.osf1,comp.unix.programming This is a multi-part message in MIME format. --------------73A4116C69F3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Greetings everyone, I am compiling on DEC UNIX 3.2 with libg++ 2.7.1 and g++ 2.7.2.2. I have been trying to seperate the actual "code" out of template definitions because the linker is complaining about mulitple definitions of objects. ******************************interface below*************** template struct EndPoint { Protocol NativeDev; private: unsigned int state; public: EndPoint::EndPoint(Trans attribs, Protocol p); Read ( unsigned int *AmountToReadP , unsigned char *buffer); Write( unsigned int *AmountToWriteP, unsigned char *buffer); // EndPoint::~EndPoint() { unsigned int a;a=a;}; }; *************interface above******************************** ******************implementation below********************** #pragma implementation EndPoint::EndPoint(Trans attribs, Protocol p){ jack Thisjack; BindTransEnd * tcpbnd; CircuitMaker MakeRoute; const bstring null_bstr(""); bstring * error_pbstr; Thisjack(* p); if (p->jProto_get_status()==FALSE) { cerr << p->jProto_get_error() << endl; } tcpbnd=new BindTransEnd (attribs,* p) ; // this must create the address structure or initialize // the protocol's filename and mode.... //whether it is for this end or the other... if (p->jProto_get_status()==FALSE) { cerr << p->jProto_get_error() << endl; } this->state = 2; this->NativeDev = MakeRoute(attribs,p); if (this->NativeDev->jProto_get_status()==FALSE) { cerr << p->jProto_get_error() << endl; } } template EndPoint::Read( unsigned int *AmountToReadP, unsigned char *buffer) { unsigned int co_byts_read; bstring *tmp_pbstr; if ((co_byts_read= recv(this->NativeDev->jProto_get_native(),(char*)buffer,*AmountToRea dP,0))==-1) { tmp_pbstr = new bstring(strerror(errno)); this->NativeDev->jProto_set_error_string(*tmp_pbstr); } //cryptDecrypt(context,buffer,*AmountToReadP); } template EndPoint::Write(unsigned int *AmountToWriteP, unsigned char *buffer) { int co_byts_writn; bstring *tmp_pbstr ; if ((co_byts_writn= send (this->NativeDev->jProto_get_native(),(char*)buffer,*AmountToWr iteP,0))==-1) { tmp_pbstr = new bstring(strerror(errno)); this->NativeDev->jProto_set_error_string(*tmp_pbstr); } // cryptEncrypt(context,buffer,*AmountToWriteP); } //typedef EndPoint TCPIPend; typedef EndPoint FILEend; FILEend::Write(unsigned int *AmountToWriteP, unsigned char *buffer){ bstring *tmp_pbstr ; if (this->NativeDev->jProto_get_native().filemodeP->checkMode(jMode_write)) this->NativeDev->jProto_get_native().a_ostrmP->write((const char*)buffer,*Am ountToWriteP); else return -1; // tmp_pbstr = new bstring(strerror(errno)); // this->NativeDev->jProto_set_error_string(*tmp_pbstr); // cryptEncrypt(context,buffer,*AmountToWriteP); } FILEend::Read(unsigned int *AmountToReadP, unsigned char *buffer) { bstring *tmp_pbstr; if (this->NativeDev->jProto_get_native().filemodeP->checkMode(jMode_read)) { if (this->NativeDev->jProto_get_native().filemodeP->checkMode(jMode_byline )) { this->NativeDev->jProto_get_native().a_istrmP->getline((char*)buffer,* AmountToReadP); } else { this->NativeDev->jProto_get_native().a_istrmP->read((char*)buffer,*Amo untToReadP); } } else return -1; // tmp_pbstr = new bstring(strerror(errno)); // this->NativeDev->jProto_set_error_string(*tmp_pbstr); //cryptDecrypt(context,buffer,*AmountToReadP); } **************implementation above************************** Thanks in advance, J.C. Magras P.S. I am posting here because comp.lang.c++ is full of little minded PC flamewares and very little information. -- Unix Software Engineer looking for C++/UNIX/Motif/Perl/Tk/Flex Software Engineering position **NOW**. Currently in Austin at (512) 672-5778/magrasjc@texas.net. have Answering machine. --------------73A4116C69F3 Content-Type: text/plain; charset=us-ascii; name="temp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="temp" /jWare/source/obj/alpha/jWare.o: filname_::filname_(void): multiply defined /jWare/source/obj/alpha/jWare.o: filname_::operator=(filname_ &): multiply defined /jWare/source/obj/alpha/jWare.o: filname_::operator==(filname_ &): multiply defined /jWare/source/obj/alpha/jWare.o: filname_::operator!=(filname_ &): multiply defined /jWare/source/obj/alpha/jWare.o: NetProtocol::~NetProtocol(void): multiply defined /jWare/source/obj/alpha/jWare.o: NetProtocol::jProto_get_status(void): multiply defined /jWare/source/obj/alpha/jWare.o: NetProtocol::NetProtocol(void): multiply defined /jWare/source/obj/alpha/jWare.o: NetProtocol::jProto_set_error_string(basic_string > &): multiply defined /jWare/source/obj/alpha/jWare.o: NetProtocol::jProto_set_native(filname_) : multiply defined /jWare/source/obj/alpha/jWare.o: NetProtocol::~NetProtocol(void): multiply defined /jWare/source/obj/alpha/jWare.o: NetProtocol::jProto_iocntrl(unsigned int): multiply defined /jWare/source/obj/alpha/jWare.o: gethost::operator()(basic_string > &, sockaddr_in &): multiply defined /jWare/source/obj/alpha/jWare.o: getserv::operator()(basic_string > &): multiply defined /jWare/source/obj/alpha/jWare.o: EndPoint *>::Write(unsigned int *, unsigned char *): multiply defined /jWare/source/obj/alpha/jWare.o: EndPoint *>::Read(unsigned int *, unsigned char *): multiply defined --------------73A4116C69F3--