Roedy Green said:
I have had some requests to provide 64-bit versions of my JNI.
I wondered if anyone has any pearls to share about the process.
One puzzle, what sort of naming convention do you use to keep track of
the 32 and 64-bit version of a DLL? I would think you need to create
a new extension for 64-bit DLLs, e.g. *.DLL64 for loadLibrary to
automatically select the correct version.
one option myself (and a few others have used) at times is to make DLL's
with an arch suffix on the DLL base:
foox86.dll
foox64.dll
fooppc.dll
....
if done on a larger scale, it could allow multiple versions of an app to
easily "co-exist" as each EXE/DLL will depend on the particular DLL version
it needs.
the big downside is that it is a big hassle and meshes poorly with typical
build technologies...
foo.x86.dll
could also work, only that a little more care is needed with this convention
(some pieces of code floating around tend to rip-out extensions starting
from the start of a string rather than the end...).
typically, they create different builds for each arch.
for necessarily multi-arch projects (such as Windows), they put different
files in different directories, such as internally having a separate
"system32" directory for 32 and 64-bit apps, ...
so, an app using this strategy could have:
AppDir/Bins-x86
AppDir/Bins-x64
AppDir/Libs-x86
AppDir/Libs-x64
....
however, much like the prior strategy, this is also a big hassle (and it
doesn't help that, AFAICT, one can't just add directories to the LoadLibrary
search path, which would have been rather useful in a few cases).
granted, for some uses I have written a custom DLL loader, which does have a
few merits here (and also a few notable costs, mostly WRT OS and debugger
visibility, and as such I typically don't use this as a "general" DLL
loading strategy on Windows...).
Is there only one flavour of 64-bit windows app, or are their
Intel/AMD subflavours?
luckily, x86-64 is (mostly) the same between the 2 archs (the differences
are few and minor enough to where most code would unlikely ever notice...).
granted, this is also the case with 32-bit x86 as well.
it is always possible that one could produce vendor-specific code, but as a
general rule, compilers tend not to do this without explicit switches (if
they support these vendor-specific features at all).
so, they are the same arch, even despite the branding differences, ...
this is, after all, why most call it x86-64 or x64, rather than AMD64 and
EM64T...
Obviously I could research this on my own, but I thought the
discussion would be of general interest.
who knows...