How do you create a freestanding C++ program?

2019-03-11 12:13发布

I'm just wondering how you create a freestanding program in C++?

Edit: By freestanding I mean a program that doesn't run in a hosted envrioment (eg. OS). I want my program to be the first program the computer loads, instead of the OS.

标签: c++
7条回答
我只想做你的唯一
2楼-- · 2019-03-11 13:05

Have a look at this article:

http://www.codeproject.com/KB/tips/boot-loader.aspx

You would need a little assembly start-up code to get you as far as main() but then you could write the rest in C++. You'd have to write your own heap manager (new/delete) if you wanted to create objects at runtime and your own scheduler if you wanted more than one thread.

查看更多
登录 后发表回答