Thread: [Opentnl-general] TNL_IMPLEMENT_RPC Build Error
Brought to you by:
mark_frohnmayer,
s_alanet
From: Bren <br...@sa...> - 2005-03-30 09:40:05
|
I=B4m having a problem building a GhostConnection subclass. NetworkConnection.h #ifndef _NETWORKCONNECTION_H_ #define _NETWORKCONNECTION_H_ class NetworkConnection : public TNL::GhostConnection { typedef TNL::GhostConnection Parent; public: TNL_DECLARE_NETCONNECTION(NetworkConnection); // declare the client to server message TNL_DECLARE_RPC(rpcMessageClientToServer, (const char *theMessageString)); // declare the server to client message TNL_DECLARE_RPC(rpcMessageServerToClient, (const char *theMessageString)); }; #endif NetworkConnection.cpp #include "NetworkIncludes.h" TNL_IMPLEMENT_NETCONNECTION(NetworkConnection, TNL::NetClassGroupGame, true); TNL_IMPLEMENT_RPC(NetworkConnection,=20 rpcMessageClientToServer,=20 (const char * messageString),=20 (messageString), TNL::NetClassGroupGameMask,=20 TNL::RPCGuaranteedOrdered,=20 TNL::RPCDirClientToServer,=20 0) { // display the message the client sent printf("Got message from client: %s\n", messageString); // send a hello world back to the client. rpcMessageServerToClient("Hello, World!"); } TNL_IMPLEMENT_RPC(NetworkConnection,=20 rpcMessageServerToClient,=20 (const char * messageString), (messageString), TNL::NetClassGroupGameMask,=20 TNL::RPCGuaranteedOrdered,=20 TNL::RPCDirServerToClient,=20 0) { // display the message the server sent printf("Got a message from server: %s\n", messageString); // once the client has heard back from the server, it should quit. // gQuit =3D true; } The build error: d:\Project\tnl\tnl\tnlMethodDispatch.h(85) : error C2664: =B4bool TNL::BitStream::read(TNL::ByteBuffer *)=B4 : cannot convert parameter 1 from =B4const char ** =B4 to =B4TNL::ByteBuffer *=B4 Types = pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast This is based on the Hello World sample, but changed from EventConnection to GhostConnection. I poured through the TNLTest source and didn't see any significant differences. Any suggestions? --=20 I am using the free version of SPAMfighter for private users. It has removed 28057 spam emails to date. Paying users do not have this message in their emails. Try www.SPAMfighter.com for free now! |
From: Ville A. B. <vbe...@cc...> - 2005-03-30 10:51:25
|
On Wed, 30 Mar 2005, Bren wrote: > I=B4m having a problem building a GhostConnection subclass. > // declare the client to server message > TNL_DECLARE_RPC(rpcMessageClientToServer, (const char > *theMessageString)); > TNL_IMPLEMENT_RPC(NetworkConnection, > rpcMessageClientToServer, > (const char * messageString), > (messageString), > TNL::NetClassGroupGameMask, > TNL::RPCGuaranteedOrdered, > TNL::RPCDirClientToServer, > 0) > The build error: > > d:\Project\tnl\tnl\tnlMethodDispatch.h(85) : error C2664: =B4bool > TNL::BitStream::read(TNL::ByteBuffer *)=B4 : cannot convert parameter 1 > from =B4const char ** =B4 to =B4TNL::ByteBuffer *=B4 Types point= ed to are > unrelated; conversion requires reinterpret_cast, C-style cast or > function-style cast > Any suggestions? If you use OpenTNL 1.5.0, your problem is the same one that I presented=20 here a few days ago. Replace the const char* with a TNL::StringPtr. Cheers, Ville --=20 Ville Bergholm | vbe...@cc... | http://www.hut.fi/u/vberghol= / mobile +358-44-5722802 Lehtisaarentie 6 G telephone +358-9-4582738 00340 Helsinki, Finland |
From: Bren L. <bl...@te...> - 2005-04-02 21:47:17
|
Ah, sorry for the dupe, I just joined the list. TNL::StringPtr did fix the problem. :) > -----Original Message----- > From: ope...@li... > [mailto:ope...@li...] On=20 > Behalf Of Ville Axel Bergholm > Sent: Wednesday, March 30, 2005 2:51 AM > To: ope...@li... > Subject: Re: [Opentnl-general] TNL_IMPLEMENT_RPC Build Error >=20 >=20 > On Wed, 30 Mar 2005, Bren wrote: >=20 > > I=B4m having a problem building a GhostConnection subclass. >=20 > > // declare the client to server message > > TNL_DECLARE_RPC(rpcMessageClientToServer, (const char > > *theMessageString)); >=20 > > TNL_IMPLEMENT_RPC(NetworkConnection, > > rpcMessageClientToServer, > > (const char * messageString), > > (messageString), > > TNL::NetClassGroupGameMask, > > TNL::RPCGuaranteedOrdered, > > TNL::RPCDirClientToServer, > > 0) >=20 > > The build error: > > > > d:\Project\tnl\tnl\tnlMethodDispatch.h(85) : error C2664: =B4bool > > TNL::BitStream::read(TNL::ByteBuffer *)=B4 : cannot convert=20 > parameter 1 > > from =B4const char ** =B4 to =B4TNL::ByteBuffer *=B4 Types=20 > pointed to are > > unrelated; conversion requires reinterpret_cast, C-style cast or > > function-style cast >=20 > > Any suggestions? >=20 > If you use OpenTNL 1.5.0, your problem is the same one that I > presented=20 > here a few days ago. Replace the const char* with a TNL::StringPtr. >=20 >=20 > Cheers, > Ville >=20 > --=20 > Ville Bergholm | vbe...@cc... | > http://www.hut.fi/u/vberghol/ >=20 > mobile =20 > +358-44-5722802 Lehtisaarentie 6 G > telephone +358-9-4582738 00340 Helsinki, Finland >=20 >=20 > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from > real users. Discover which products truly live up to the=20 > hype. Start reading now.=20 > http://ads.osdn.com/?ad_ide95&alloc_id=14396> &op=3Dick >=20 > _______________________________________________ >=20 > Opentnl-general mailing list Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opentnl-general >=20 --=20 I am using the free version of SPAMfighter for private users. It has removed 28798 spam emails to date. Paying users do not have this message in their emails. Try www.SPAMfighter.com for free now! |
From: Ville A. B. <vbe...@cc...> - 2005-04-19 16:32:41
|
Hi, I would like to use a BitStream as an RPC parameter. Since the OpenTNL RPCs already accept ByteBuffer parameters, I guess this should be possible, but what would be the safest way of doing it? On the calling side I can use void Send(XXX &myobject) { BitStream s; myobject.Write(s); connection->rpcSend(s); } but what about the receiving side? I was thinking of something like TNL_IMPLEMENT_RPC(MyConnection, rpcSend, (ByteBufferPtr buf), (buf), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0) { BitStream s(buf->getBuffer(), buf->getBufferSize()); XXX myobject; myobject.Read(s); ... } Does this approach work, or am I completely on a wrong track here? Thanks in advance, Ville -- Ville Bergholm |