Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

can you tell me how this simple hello world program works on wondows system and linux

Status
Not open for further replies.

sagar474

Full Member level 5
Joined
Oct 18, 2009
Messages
285
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,318
Location
India,kakinada
Activity points
3,122
#include<stdio.h>

int main()
{

printf("Hello world");

return 0;
}

is this program is operating system independent?
no only java like programs can run operaing system independent.

but these type of programs dose not call any APIs during execution how they work?

please help to understand.
thank you.
 

windows and unix have gcc compiler support , which when installed installs all the standard library functions in its folder... so stdio.h is an library file with standard pre-defined API's...

using this API's the output is printed on the console.........
 
then what will API will do?
they pass an interrupt ( int 21) to the processor?
and then what then kernel will do?
 

int 21 implements the kernel of msdos.
 
TITLE ch04p8 This is the string
.MODEL small
.data

message db "This is the string",0dh,0ah,'$'

.code
main proc

mov ax,@data
mov ds,ax

mov ah,9
mov dx, offset message
int 21h
mov ax,4C00h
int 21h
main endp

end main


dose this program works in UNIX?

---------- Post added at 19:49 ---------- Previous post was at 19:48 ----------

the program in assembly and C
will works in same way?
 

the given program will not work in linux.
it is msdos assembly program .
can be executed under windows only.
 
...but these type of programs dose not call any APIs during execution how they work?...

Program codes wrote in C language are aimplicitly core independent.
It´s up to each compiler generate binary file according target microcontroler.
Remember that C language is sintax-standardized.

Thus those C program codes have an inherent property to run in diferents platforms (different uC cores) with few and little adjusts.

+++
 
ya now I'm gating understand a little about kernels, ISR and OS.
 

#include<stdio.h>
int main()
{
printf("Hello world");
return 0;
}
is this program is operating system independent?
no only java like programs can run operaing system independent.
thank you.
so long as a C/C++ program uses standard APIs (such as your example) the C/C++ source program may be ported to systems with a different architecture or operating system (e.g. Windows to Linux), recompiled and run. Java, however, does not need to be recompiled. Once compiled from a .java source to a .class the .class file may be ported and will run on any system with a JVM (Java Virtual Machine). This is one of the advantages of Java over C++, e.g. one may write a client/server system in Java and port it without problems. That is not the case in C/C++.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top