摘要:
关于函数的调用规则(调用约定),大多数时候是不需要了解的,但是如果需要跨语言的编程,比如VC写的dll要delphi调用,则需要了解。 microsoft的vc默认的是__cdecl方式,而windows API则是__stdcall,如果用vc开发dll给其他语言用,则应该指定__stdcall方式。堆栈由谁清除这个很重要,如果是要写汇编函数给C调用,一定要小心堆栈的清除工作,如果是__cdecl方式的函数,则函数本身(如果不用汇编写)则不需要关心保存参数的堆栈的清除,但是如果是__stdcall的规则,一定要在函数退出(ret)前恢复堆栈。1.__cdecl 所谓的... 阅读全文
posted @ 2012-12-19 23:28
邵贤军
阅读(512)
评论(0)
推荐(0)
摘要:
1 #include <stdio.h> 2 #include <stdarg.h> 3 4 void WriteFormatted (FILE * stream, const char * format, ...) 5 { 6 va_list args; 7 va_start (args, format); 8 vfprintf (stream, format, args); 9 va_end (args);10 }11 12 int main ()13 {14 FILE * pFile;15 16 pFile = fopen ("myfile.txt&qu 阅读全文
posted @ 2012-12-19 22:58
邵贤军
阅读(461)
评论(0)
推荐(0)

浙公网安备 33010602011771号