Welcome, Guest. Please login or register.

Author Topic: Odd programming question  (Read 6582 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« on: March 09, 2008, 06:55:03 PM »
@trekiej
Quote
Outside of header files and libraries, when does OS specific information get added?

Could you clarify that question a bit? What OS specific information?
Quote
When I run a programm, how does the OS allocate memory and give control to the application and the application give it back.

OS allocates memory in whatever way it does. You don't need to worry about that. Or what exactly are you asking here?

Entering the application typically happens by entering the very beginning of the first (code) segment. Application gives the control back by executing 'return from subroutine' with the original stack pointer (some platforms have different way to terminate, however).

Quote
The OS gives the application access to resources, how does it know what to give?

Again, I'm not quite sure what you're asking here. Access control for privileged resources?
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« Reply #1 on: March 09, 2008, 07:42:48 PM »
Well, considering this is in Alternative Operating Systems section I don't think he's asking about AmigaOS ABI in particular.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« Reply #2 on: March 09, 2008, 07:44:42 PM »
Erm. Now I'm really confused.

If you're writing programs you don't need to know how the ABI works internally, It Just Works.

If you wish to have a GUI, look into intuition and gadtools, or if you wish to have something more fancy, MUI. All of those have plenty of programming examples (intui in RKRM, MUI in mui dev archive).
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« Reply #3 on: March 09, 2008, 07:57:26 PM »
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« Reply #4 on: March 09, 2008, 08:11:05 PM »
Such as?

(There is startup code added normally, but why would you need to worry about it?)
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« Reply #5 on: March 09, 2008, 08:16:18 PM »
That's C++.

Why would you need to worry about how it works? Those things are something you don't need to worry about. You can concentrate on your own code.

Anyhoo, iostream is typically compiler specific. If you really must, you could take a look at gcc implementation for example. I can't see a reason to bother oneself about such messy details, however.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« Reply #6 on: March 09, 2008, 10:10:32 PM »
Sure all that is very interesting indeed, but I think it might be a bit too early for trekiej to delve into all that yet.

Granted, class explaining how to build your own OS from scratch could work even for beginners (as you then are not required to read and understand thousands of lines of existing code).
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Odd programming question
« Reply #7 on: March 10, 2008, 06:48:30 PM »
Quote
It is how the OS looks at and responds to the program. I wish I had a explanation of all that happens when a program loads. This is imo different for different OS.

Even if it is, you don't need to worry about it. As long as you use the C standard library functions you will be just fine, regardless of the underlying OS.

That's the beaty of ANSI C, it's very very portable.