<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 3, 2012, at 10:16 PM, John Von Seggern wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Times; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">Does OpenJDK continue to take this approach?<br><br></span></span></blockquote><div><br></div>Depends on who does the build. The default might be to statically link, pretty sure anyway.</div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Times; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">I'm asking because I would like to use the Java Native Interface to<br>call functions in a C++ library (that statically links the C++<br>runtime). When I distribute my application, do I need to worry about<br>C++ ABI compatibility issues?</span></span></blockquote><br></div><div>When you distribute a C++ application you always need to worry about compatibility issues.</div><div><br></div><div>If you statically link in a C++ library, you need to make sure you are not also providing those</div><div>interfaces as your own public exported interfaces, if you use the proper version scripts (mapfiles) this</div><div>kind of thing can work fine. But it means that you have baked in the implementation of code that</div><div>you don't maintain, and any bugs in that code requires you to rebuild your product and re-ship.</div><div>There is a maintenance cost to static linking.</div><div><br></div><div>So in general, doing static linking is a bad idea and should not be done lightly, if ever.</div><div><br></div><div>On Solaris, in OpenJDK makefiles, there is no static linking, or shouldn't be any.</div><div><br></div><div>On Windows, we do static linking of some DLLs, but not the primary one MSVCR100.DLL,</div><div>except in rare cases, which I try to burn from my memory every time I see them,</div><div>and we have lots of debates on that issue. With Windows you have to ship the</div><div>MSVC*.DLLs with your product, so there are space considerations, big DLLs here.</div><div><br></div><div>On Linux, we shouldn't use static linking, but we had to a long time ago, and we just haven't undone</div><div>it completely. Obviously the distros don't want static linking, but when Oracle builds a Linux</div><div>distribution, the binaries need to run on a variety of Linux systems, so we need to be careful, and</div><div>we don't want to build a separate Oracle JDK for every Linux distro.</div><div>It is quite possible that we don't need to static link anything anymore, but that would need to be verified.</div><div>When the initial JDK4 work was done on Linux, static links of the C++ runtime was the only way</div><div>for us to create binaries that had any chance of running on a variety of distributions of Linux.</div><div><br></div><div>Of course, then there is the other sharing issue, the one where you copy the source into your</div><div>repository and build your own private version of a library that also ships with the underlying system.</div><div>That's another story.</div><div><br></div><div>-kto</div><div><br></div><div><br></div><br></body></html>