liteserver / binn

Binary Serialization
Apache License 2.0
440 stars 58 forks source link

Problem with send() using binn object #15

Closed hubertcy closed 6 years ago

hubertcy commented 6 years ago

Hi here is the section of codes to test on my end. binn *obj; // create a new object obj = binn_object();

//Assign stuff to this object
binn_object_set_int32(obj, "id", 123);
binn_object_set_str(obj, "name", "John");
binn_object_set_double(obj, "total", 2.55);
send(s , binn_ptr(obj) , binn_size(obj), 0);

Then I get an error saying "IntelliSense: argument of type "void " is incompatible with parameter of type "const char "

The libraries I use are:

include

include

include "binn.h"

include

pragma comment(lib,"ws2_32.lib")

The current WinSock2.h library defines send() to be: send( in SOCKET s, in_bcount(len) const char FAR * buf, in int len, in int flags );

How did you overwrite the send() to accept object type?

Thanks, Hubert

hubertcy commented 6 years ago

Just so you know I am using Visual Studio 2010 Professional on Windows 10.

kroggen commented 6 years ago

You can try

send(s , (const char *) binn_ptr(obj) , binn_size(obj), 0);

But if it compiles, then there is no problem. It is just the IntelliSense.