hi,
I have some problems with winsock library so I am calling loading it dynmically then calling the functions so far so good,but the problem is for example I see in the winsock2 header files that -
GetHostByName and some other functions are which I use there prototypes is kinda weird for example GetHostByName prototype is
DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);

I know gethostbyname returns a struct hostent * but I don't see its calling convetion neither __stdcall or pascal or fastcall so I can convert it into typedef pointer then use it to dynmically call the function.

thanks.

MrNoob.

You should solve the other (winsock library) problem. Loading the library dynamically causes all kinds of "weirdness", leading to unreadable and hard-to-maintain code. The typedef would be something like

typedef __stdcall struct hostent * (*)(const char *) p_gethostname;

The macro name DECLARE_STDCALL_P suggests __stdcall may be appropriate.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.