views:

41

answers:

1

Hi all,

I'm deep in trouble with my project.

I have to link two radar with my program, but the first has its own library that uses winsock, while in the second I want to use winsock2.

How can i do that?

At the moment i get many redefinition errors from the includes within winsock.h and winsock2.h.

Take into account that the first radar library is already an DLL, i've got only a header and lib file (no source).

Thank you in advance for any answer.

A: 

You could possibly work around the compilation problem by structuring your code (and precompiled headers) so that no file includes both winsock.h and winsock2.h, this may mean either not using precompiled headers at all or using them in a more complex way than is normal in MFC projects...

You could wrap each DLL in a COM object and access them via COM from your main program. This has the advantage of completely separating the use of the two DLLs from your main compilation.

You could wrap each of the DLLs in a new DLL (one each) which provides an interface to your program that does not need the winsock headers in the interface headers.

Of course this may simply be an issue with your Windows.h include order, try putting this at the top of your precompiled header...

#ifndef _WINDOWS_
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif

#include <winsock2.h>
Len Holgate
which bit worked?
Len Holgate