ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
There is no way to directly run applications compiled for Linux in Windows.
Cygwin is an environment in Windows which provides all the Linux tools and system calls. You can recomplie Linux applications in Cygwin and then they will run in Cygwin.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
You can also write a portable application in C by using libraries available on both sides, and compile one binary version for each target O/S and architecture.
A simpler way would be to use a portable language like Java.
to answer boxerboy's question, that's useful for not having to re-install cygwin (and inherantly - everything) to get a minor update for 'less'.
_____________
on the machine level shouldn't 'hello-world' work on both os's (because it is not calling any outside dll/ shared lib or kernal dependant code). considering how efficient gcc versus vs6/.net is, shouldn't the byte code they generate be similar.
has anyone compared the hex code/ assembly instructions created on both platforms for 'hello-world'?
i never tried this but i assume it to be true (x86 is x86 regardless of the operating system).
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
is there anything wrong with my theory?
I'm not at all a Win32 expert, but here are some areas where differences will probably (or certainly) destroy your theory:
executable file format
relocation
dynamic linking method
function calling conventions
CPU register usage
memory model
interruption handling
...
i never considered those os layer tasks, they are so transparent you don't really think of it much.
well java cheats in that it is not multi-platform. it works on only one platform (jvm). in order to run programs you will have to install a jvm specific to each platform.
doesn't this add more overhead as in another layer of translation/ interpreting (more clock cycles)?
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
well java cheats in that it is not multi-platform. it works on only one platform (jvm). in order to run programs you will have to install a jvm specific to each platform.
That's no specific to Java, it is simply the only way to provide binary portability whatever the underlying platform is.
Same could be said to interpreted languages, which need a runtime too.
Quote:
doesn't this add more overhead as in another layer of translation/ interpreting (more clock cycles)?
It adds some overhead, undoubtly.
Whether this has a visible impact on perceived performance depend on many other factors.
Quote:
not a big fan of the java,
You should reconsider that, Java used to be somewhat sluggish at the beginning, but with modern versions, the on the fly compilation make difference fade vs native code.
For example, I'm working since a couple of weeks ago with a free, open source 3D modeler, with ray tracing rendering in full java (Art Of Illusion). Manipulating a bunch of complex 3D objects is impressivly fast and show a good sample of what java is able to do now.
Take a look at trollteck QT designer. We use it for all our GUIs.
The customers love it too. Windows, Linux, Solaris, very nice.
You do have to compile the app for each target to create the executables,
its rarely a problem... depending on what you're trying to do. http://www.trolltech.com/products/qt/index.html
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.