mainWCRTStartup 与 wmain
来源:互联网 发布:网络区域推广方法 编辑:程序博客网 时间:2024/06/05 09:35
The C Run-Time Libraries for Windows CE (CRT) provide many useful functions that can make programming much easier.
The CRT resides in two core libraries, COREDLL.DLL and CORELIBC.LIB.
- You can link to the portion of the CRT in COREDLL.DLL by linking with COREDLL.LIB, the import library for COREDLL.DLL.
- CORELIBC.LIB contains the CRT startup routines. In addition, it contains other CRT routines that you must link to statically, primarily to ensure optimum performance.
When you link your image, you explicitly or implicitly specify an entry point that the operating system will call into after loading the image.
For a DLL, the default entry point is _DllMainCRTStartup.
For an EXE, the default entry is wWinMainCRTStartup, the Unicode entry point for an EXE that defines the wWinMain function, orWinMainCRTStartup otherwise.
You can rely on the default entry point that the linker chooses, but the best practice is usually to override the default choice. Instead, specify an entry point with the /ENTRY linker option.
Windows CE supports the following CRT entry points:
- mainACRTStartup for applications that define the main function
- mainWCRTStartup for applications that define the wmain function
- WinMainCRTStartup for applications that define the WinMain function
- wWinMainCRTStartup for applications that define the wWinMain function
- _DllMainCRTStartup for DLLs
For more information, see the linker topic /ENTRY (Entry-Point Symbol).
Note If you want to use mainACRTStartup or mainWCRTStartup, you must explicitly state that when you specify the /ENTRYoption.
_tmain:
1. main是所有C或C++的程序执行的起点,_tmain是main为了支持unicode所使用的main的别名。
2. _tmain需要一个返回值,而main默认为void。
3. _tmain的定义在<tchar.h>可以找到,如#define _tmain main,所以要加 #include <tchar.h> 才能用。
4. _tmain()是个宏,如果定义了UNICODE,则他是wmain(),否则他是main()。
5. _tmain这个符号多见于VC++创建的控制台工程中,这个是为了保证移植unicode而加入的。
6. 一般_t、_T、T()这些东西都是宏都和unicode有关系。
7. 对于使用非unicode字符集的工程来说,实际上_tmain和main没有差别。
8. 因此_tmain编译后后仍为main,所以都可以执行。
9. main()是WINDOWS的控制台程序(32BIT)或DOS程序(16BIT)。
10.WinMain()是WINDOWS的GUI程序。
11.另外,wmain也是main的另一个别名,是为了支持二个字节的Unicode语言环境。
-----------------------
int main( int argc, char *argv[ ], char *envp[ ])
wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] )
int _tmain(int argc, _TCHAR* argv[ ])
参考文章:
http://msdn.microsoft.com/en-us/library/ms859584.aspx
http://blog.sina.com.cn/s/blog_48a45b950100ykwl.html
- mainWCRTStartup 与 wmain
- _tmain(),wmain与main函数
- _tmain与main,winMain,wmain
- _tmain与main,winMain,wmain收藏
- _tmain与main,winMain,wmain收藏
- _tmain main wmain WinMain
- main(),_tmain(),WinMain(),wmain()四个函数区别
- Python3.1.2:wmain,main,_tmain的区别
- _tmain,main,wmain三者区别
- 命令行参数wmain (int argc,wchar_t *argv[])
- main(), _tmain(), wmain(), wWinMain(), _tWinMain()的区别
- main,wmain: a ansi,unicode version of _tmain
- 关于不同的程序入口,main(), _tmain(),WinMain(),wmain()?
- MSVCRTD.lib(wcrtexe.obj) : error LNK2001: unresolved external symbol wmain
- 关于main和_tmain和wmain的区别
- 关于不同的程序入口,main(), _tmain(),WinMain(),wmain()?
- 关于不同的程序入口,main(), _tmain(),WinMain(),wmain()?
- 解决error LNK2019: unresolved external symbol __imp_SHCreateStreamOnFileW referenced in function wmain
- DBF格式
- #inclue<math.h>函数学习 不断更新
- 概率分布-二项分布、多项分布
- 虚拟机问题-提示找不到系统
- 二分搜索递归与非递归C语言实现
- mainWCRTStartup 与 wmain
- 读《黑客与画家》
- bat文件启用dos命令
- [小代码]转换dp单位为px像素
- silverlight 版本判断
- linux字符驱动例子
- ubuntu安装mysql(tar.gz)
- JAVA中string.repalce()和string.replaceAll()有什么区别?
- POJ 1384 PigBank