943,553 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Marked Solved
  • Views: 2079
  • Assembly RSS
Dec 22nd, 2007
0

execute a c program

Expand Post »
How would I execute a C/C++ program without using a windows library? (Like ShellExecute)
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Queatrix is offline Offline
13 posts
since Mar 2007
Dec 22nd, 2007
0

Re: execute a c program

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.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Dec 23rd, 2007
0

Re: execute a c program

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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Queatrix is offline Offline
13 posts
since Mar 2007
Dec 23rd, 2007
0

Re: execute a c program

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.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Dec 24th, 2007
0

Re: execute a c program

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
Reputation Points: 47
Solved Threads: 17
Posting Whiz in Training
Tight_Coder_Ex is offline Offline
215 posts
since Feb 2005
Dec 24th, 2007
0

Re: execute a c program

Okay, I will try to go about it a little differently, or do as you said.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Queatrix is offline Offline
13 posts
since Mar 2007
Dec 24th, 2007
0

Re: execute a c program

Oh, I didn't see your post, Tight. I will look into that as well.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Queatrix is offline Offline
13 posts
since Mar 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: I know Im dim
Next Thread in Assembly Forum Timeline: question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC