<div dir="ltr">As far as I know Java follows "compile once, run anywhere", so as long as you target the same Java edition (Java EE/Java SE/Java ME/etc.) every standard compliant JVM should execute the same bytecode correctly.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-07 10:04 GMT+02:00 Sandeep Kumar Singh <span dir="ltr"><<a href="mailto:deepdondo007@gmail.com" target="_blank">deepdondo007@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Andreas,</div><div> </div><div>Thanks for detailed explanation. Now it is very clear to me that I should write first platform independent code to make it work correct.</div><div>As I know, Java is platform independent, will I face the same issue with it?</div><div> </div><div>Thanks and Regards,</div><div>Sandeep</div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Tue, Jul 7, 2015 at 1:14 PM, Andreas Weber <span dir="ltr"><<a href="mailto:andreas.c.weber@gmail.com" target="_blank">andreas.c.weber@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Sandeep,<br><br>As far as I know, it depends: If you have portable C/C++ source (e.g.
with ifdefs to handle platform specific stuff) you can compile this
source with the Linux-defines on Linux to generate a working Linux
binary or you can compile the same source on Windows with the
Windows-defines to generate a working Windows binary.<br><br>As
LLVM/clang is inherently a cross-compiler you can also generate the
windows object files on Linux when you pass the correct target triple
and the Windows-defines to your Linux-clang or vice-versa. Note that
this will only give you object files which you still need to link to
obtain a working executable (usually with your system linker, link.exe
on Windows, ld on Linux).<br><br>What will not work is compiling the
source with a Linux target triple and Linux-defines into bitcode and
then compile this bitcode into a Windows object file and expect it to
link and run correctly. The reason is that the bitcode already encodes
target specific information as it represents preprocessed code and was
generated to target a specific platform ABI defining stuff like name
mangeling, struct and vtable layout, exception handling, calling
convention, etc.<br><br>You might get away compiling a Linux-bitcode
file into a working Windows object file when you restrict yourself to
platform independent C (the preprocessed source is identical on Windows
on Linux) and have only scalar values as function parameters but I would
not recommend this approach.<br><br></div>Best regards<span><font color="#888888"><br></font></span></div><span><font color="#888888">Andreas<br></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>2015-07-07 8:13 GMT+02:00 Sandeep Kumar Singh <span dir="ltr"><<a href="mailto:deepdondo007@gmail.com" target="_blank">deepdondo007@gmail.com</a>></span>:<br></div></div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote"><div><div><div dir="ltr">Hi,<div><br></div><div>I am curious to know about LLVM IR as platform independent feature.</div><div>I have compiler some C and C++ applications that compiled on Linux 64bit machine, now I want to generate bit code file on Windows 64bit machine.</div><div><br></div><div>1) Will this execute without any issues? </div><div>2) Do I pass any option for making it operating system portable? </div><div>3) Can I generate bit code file also on Linux machine and then run on Windows machine?</div><div><br></div><div>Please give me some pointers?</div><div><br></div><div>Any help will be highly appreciated.<br clear="all"><div><br></div><br><div>Thanks and Regards,<br>Sandeep</div>
</div></div>
<br></div></div><span>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><br>Thanks and Regards,<br>Sandeep Kumar Singh</div>
</font></span></div>
</blockquote></div><br></div>