- /* make room for all plugins */
- _gras_trp_plugins=gras_dict_new();
-
- /* Add them */
- gras_trp_plugin_new("tcp", gras_trp_tcp_setup);
- gras_trp_plugin_new("file",gras_trp_file_setup);
- gras_trp_plugin_new("sg",gras_trp_sg_setup);
-
- /* buf is composed, so it must come after the others */
- gras_trp_plugin_new("buf", gras_trp_buf_setup);
+ if (!_gras_trp_started) {
+ /* make room for all plugins */
+ _gras_trp_plugins=xbt_dict_new();
+
+#ifdef HAVE_WINSOCK2_H
+ /* initialize the windows mechanism */
+ {
+ WORD wVersionRequested;
+ WSADATA wsaData;
+
+ wVersionRequested = MAKEWORD( 2, 0 );
+ xbt_assert0(WSAStartup( wVersionRequested, &wsaData ) == 0,
+ "Cannot find a usable WinSock DLL");
+
+ /* Confirm that the WinSock DLL supports 2.0.*/
+ /* Note that if the DLL supports versions greater */
+ /* than 2.0 in addition to 2.0, it will still return */
+ /* 2.0 in wVersion since that is the version we */
+ /* requested. */
+
+ xbt_assert0(LOBYTE( wsaData.wVersion ) == 2 &&
+ HIBYTE( wsaData.wVersion ) == 0,
+ "Cannot find a usable WinSock DLL");
+ INFO0("Found and initialized winsock2");
+ } /* The WinSock DLL is acceptable. Proceed. */
+#elif HAVE_WINSOCK_H
+ { WSADATA wsaData;
+ xbt_assert0(WSAStartup( 0x0101, &wsaData ) == 0,
+ "Cannot find a usable WinSock DLL");
+ INFO0("Found and initialized winsock");
+ }
+#endif
+
+ /* Add plugins */
+ gras_trp_plugin_new("tcp", gras_trp_tcp_setup);
+ gras_trp_plugin_new("file",gras_trp_file_setup);
+ gras_trp_plugin_new("sg",gras_trp_sg_setup);