Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10473
| Date | 2011-12-03 14:01 -0800 |
|---|---|
| From | Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: 64-bit gotcha |
| References | <vvujd71j7k73s1m61bu10eol0ebtn4iem0@4ax.com> <4eda8488$0$287$14726298@news.sunsite.dk> |
| Message-ID | <xbKdnW4-I_26AUfTnZ2dnUVZ_qqdnZ2d@posted.palinacquisition> (permalink) |
On 12/3/11 12:20 PM, Arne Vajhøj wrote: > On 12/3/2011 5:47 AM, Roedy Green wrote: >> A Java Web Start program I wrote a long time ago suddenly stopped >> working. It sets the System clock to an atomic time server. >> >> I discovered the problem was it uses a 32--bit DLL via JNI and my >> default Java is 64 bit. It cannot use 32-bit DLLs. >> >> That surprises me. I would have thought MS would have had to come up >> with a way of doing that since so many DLLs would not yet be available >> in 32-bit. Maybe it can in general, but just not in Java. > > 32 bit or 64 bit is a per process thing. > > You can't have part of a process using 32 bit addresses and > another part using 64 bit addresses. True, Windows does not support that. But it's technically feasible, and in fact 32-bit Windows supported 32-bit processes calling 16-bit DLLs (e.g. http://support.microsoft.com/kb/155763). It's a fair question to ask why Microsoft didn't do the same for 32-bit DLLs executing in 64-bit processes. I don't personally have the answer. Could be a simple matter of practicality (e.g. thunking was not beneficial enough for Win32 to justify its cost and so was not done for x64 Windows), or it might be that thunking relied on some CPU feature that supported 16-bit addressing in a 32-bit process that doesn't exist for 32-bit-addressing-in-64-bit-processes. I don't know. But saying "you can't do it" doesn't really seem to answer the question. Roedy already knows he can't do it, at least in Java, and implicit in his post is the question as to why Windows does not support calling 32-bit DLLs in 64-bit processes. > The JVM and native DLL's must have same bitness. > > It is not Java specific. > > If you are using C# then you can specify AnyCPU (32 bit or 64 bit), > x86 (32 bit only) and x64 (64 bit only) to stamp programs with > requirements. But as with Java, you cannot call native DLLs using the wrong bitness of a .NET program. A .NET program running as a 32-bit process can call only 32-bit DLLs, and a .NET program running as a 64-bit process can call only 64-bit DLLs. Other than the way that the choice is made for what kind of bitness the program is running in, it's pretty much the same situation. Pete
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
64-bit gotcha Roedy Green <see_website@mindprod.com.invalid> - 2011-12-03 02:47 -0800
Re: 64-bit gotcha Arne Vajhøj <arne@vajhoej.dk> - 2011-12-03 15:20 -0500
Re: 64-bit gotcha Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-12-03 14:01 -0800
Re: 64-bit gotcha Roedy Green <see_website@mindprod.com.invalid> - 2011-12-03 18:17 -0800
Re: 64-bit gotcha Martin Gregorie <martin@address-in-sig.invalid> - 2011-12-04 12:06 +0000
Re: 64-bit gotcha Jeff Higgins <jeff@invalid.invalid> - 2011-12-04 08:57 -0500
Re: 64-bit gotcha Jeff Higgins <jeff@invalid.invalid> - 2012-02-25 19:15 -0500
Re: 64-bit gotcha Martin Gregorie <martin@address-in-sig.invalid> - 2012-02-26 00:53 +0000
Re: 64-bit gotcha Jeff Higgins <jeff@invalid.invalid> - 2012-02-25 20:26 -0500
Re: 64-bit gotcha Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-12-04 10:04 -0400
Re: 64-bit gotcha Arne Vajhøj <arne@vajhoej.dk> - 2012-03-12 19:50 -0400
Re: 64-bit gotcha Travers Naran <tnaran@gmail.com> - 2011-12-04 09:17 -0800
Re: 64-bit gotcha Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-12-04 18:33 -0600
Re: 64-bit gotcha Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-12-04 16:56 -0800
Re: 64-bit gotcha Arne Vajhøj <arne@vajhoej.dk> - 2012-03-12 19:53 -0400
Re: 64-bit gotcha Arne Vajhøj <arne@vajhoej.dk> - 2012-03-12 19:49 -0400
csiph-web