Programming This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
08-26-2005, 02:58 AM
|
#1
|
LQ Newbie
Registered: Apr 2005
Location: Bangalore
Posts: 16
Rep:
|
How to run Linux application on Windows
Hi all,
I want to know whether can i write an application C program on linux, and able to execute on Windows.
Please tell me what is the procedure to this.
Thanks in Advance.
Sateesh Galla.
|
|
|
08-26-2005, 03:03 AM
|
#2
|
Senior Member
Registered: Aug 2005
Posts: 1,755
Rep:
|
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.
Otherwise, you can run Linux inside an emulator.
|
|
|
08-26-2005, 03:24 AM
|
#3
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,793
|
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.
|
|
|
08-26-2005, 07:29 AM
|
#4
|
Member
Registered: Jul 2005
Distribution: ubuntu5.04, ubuntu5.10, suse9.3, mandrake10.1, mandriva2006(beta), FC1-4, redhat9.0, debian sarge
Posts: 519
Rep:
|
Quote:
. Individual packages like bash, gcc, less, etc. are released independently of the DLL.
|
if im reading that right i would have to download a gcc and bash to beable to compile and run a program using Cygwin?
|
|
|
08-26-2005, 11:12 AM
|
#5
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326
|
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).
is there anything wrong with my theory?
schneidz
Last edited by schneidz; 08-26-2005 at 11:26 AM.
|
|
|
08-26-2005, 11:43 AM
|
#6
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,793
|
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
...
Go with Java or an interpreted language instead 
|
|
|
08-26-2005, 11:55 AM
|
#7
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326
|
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)?
not a big fan of the java,
|
|
|
08-26-2005, 12:45 PM
|
#8
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,793
|
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.
Last edited by jlliagre; 08-26-2005 at 04:19 PM.
|
|
|
08-26-2005, 03:31 PM
|
#9
|
Senior Member
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537
Rep:
|
I tend to still find java apps slow but hey gtk apps are slow like that as well :P
Phex is a good example of java programming. its not really slow ither.
|
|
|
08-27-2005, 12:10 AM
|
#10
|
Member
Registered: May 2004
Posts: 552
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 07:59 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|