Code Review 7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)

Chris Hegarty chris.hegarty at oracle.com
Thu Mar 24 08:27:43 PDT 2011


On 03/24/11 11:49 AM, Alan Bateman wrote:
> Chris Hegarty wrote:
>>
>> Yes, we will now have a dependency on iphlpapi.dll, but this dll is
>> part of Windows since Windows 2000 and the functions we are using are
>> all available on XP. Does this address your concern, or do you have
>> another issue?
> The concern is that we load yet another DLL at startup. It might be
> worth checking if it gets loaded already.

You are right, before these changes iphlpapi.dll is not loaded unless 
NetworkInterface or ResolverConfigurationImpl are called. After these 
changes iphlpapi.dll is loaded once net.dll is loaded.

I think we should use specify the loading of these dll's to be delayed. 
I can confirm that with the below changes iphlpapi.dll is only loaded 
when necessary.

diff -r ef5bbbe0dd75 make/java/net/Makefile
--- a/make/java/net/Makefile	Mon Mar 21 22:02:00 2011 -0700
+++ b/make/java/net/Makefile	Thu Mar 24 15:27:38 2011 +0000
@@ -37,10 +37,6 @@ AUTO_FILES_JAVA_DIRS = java/net
  AUTO_FILES_JAVA_DIRS = java/net

  ifeq ($(PLATFORM), windows)
-    # Windows 9x module only needed on 32-bit build
-    ifeq ($(ARCH_DATA_MODEL), 32)
-	FILES_c += NetworkInterface_win9x.c
-    endif
      FILES_c += NTLMAuthSequence.c
      FILES_c += NetworkInterface_winXP.c
  else
@@ -96,7 +92,9 @@ include $(BUILDDIR)/common/Library.gmk
  include $(BUILDDIR)/common/Library.gmk

  ifeq ($(PLATFORM), windows)
-  OTHER_LDLIBS = ws2_32.lib $(JVMLIB)
+  OTHER_LDLIBS = ws2_32.lib $(JVMLIB) \
+                 secur32.lib iphlpapi.lib delayimp.lib \
+                 /DELAYLOAD:secur32.dll /DELAYLOAD:iphlpapi.dll
  else
    OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB)


>> :
>>
>> I forgot to mention that I fixed a few compiler warning while I was
>> here. Are you referring to the casting of SOCKET s to jint, line 982?
>> SOCKET is an unsigned int pointer and needs an explicit cast. I
>> thought it was safe, and is what is done in Java_sun_nio_ch_Net_socket0.
> NET_Socket is declared to return an int so I assume you meant to cast to
> int rather than jint.

D'oh. Got it. Thanks,

-Chris.

>
> -Alan.



More information about the net-dev mailing list