execute a c program

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Mar 2007
Posts: 13
Reputation: Queatrix is an unknown quantity at this point 
Solved Threads: 1
Queatrix Queatrix is offline Offline
Newbie Poster

execute a c program

 
0
  #1
Dec 22nd, 2007
How would I execute a C/C++ program without using a windows library? (Like ShellExecute)
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: execute a c program

 
0
  #2
Dec 22nd, 2007
In assembly? You can (maybe) but is it worth the effort you'll need to write the loader?

The OS exists to make complicated things simple. Just use the OS functions.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 13
Reputation: Queatrix is an unknown quantity at this point 
Solved Threads: 1
Queatrix Queatrix is offline Offline
Newbie Poster

Re: execute a c program

 
0
  #3
Dec 23rd, 2007
Yes, in asm.

That's the problem, I'm making an OS, and I don't want it to depend on any other OSes. (except for DOS is fine)

I tried using INT 40h, but it doesn't seem to work. The code compiles and runs, but nothing happens on the interrupt.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: execute a c program

 
0
  #4
Dec 23rd, 2007
Ah, well, then you've got yourself in a ball of mud.

One of the primary functions of the OS is to load and execute a program. How this happens is typically and entirely dependent on the OS.

For example, Win32 cannot execute a Mac program. As far as old DOS and Win16 programs, Win32 was specifically engineered to support legacy applications, but the next generation will scrub the old DOS subsystem anyway...

If you intend to execute PE32 (Win32) programs, then you'll have to do some serious reading over at MSDN and around the net.

Otherwise, you'll have to roll your own exe format, or borrow one from another OS, and write your own loader.

Good luck.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 199
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Solved Threads: 14
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: execute a c program

 
0
  #5
Dec 24th, 2007
Maybe consider writing a small boot loader and use BIOS calls instead. Most of the functionality you need is provided by any of the PC BIOS's. That way you are completely independent of any operating system including DOS. As your project develops, then inevitably you can get rid of any BIOS dependence too like Linux
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 13
Reputation: Queatrix is an unknown quantity at this point 
Solved Threads: 1
Queatrix Queatrix is offline Offline
Newbie Poster

Re: execute a c program

 
0
  #6
Dec 24th, 2007
Okay, I will try to go about it a little differently, or do as you said.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 13
Reputation: Queatrix is an unknown quantity at this point 
Solved Threads: 1
Queatrix Queatrix is offline Offline
Newbie Poster

Re: execute a c program

 
0
  #7
Dec 24th, 2007
Oh, I didn't see your post, Tight. I will look into that as well.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1624 | Replies: 6
Thread Tools Search this Thread



Tag cloud for Assembly
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC