如何创建一个独立的C ++程序? [英] How do you create a freestanding C++ program?

查看:148
本文介绍了如何创建一个独立的C ++程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道如何在C ++中创建一个独立的程序?

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

编辑:独立式是指不在托管环境(例如操作系统)中运行的程序。我想我的程序是计算机加载的第一个程序,而不是操作系统。

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.

推荐答案

看看这篇文章:

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

你需要一个小的程序集启动代码,使你远到main()你可以写在C ++中的其余部分。如果你想在运行时创建对象,你必须编写自己的堆管理器(新的/删除),如果你想要多个线程,你需要自己的调度器。

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.

这篇关于如何创建一个独立的C ++程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆