5 个解决方案
#1
Rather than rewrite your Fortran or assembly language code, you should call your existing code from within Visual C++. Your functions and subroutines can reside in a separate module and be compiled on your native compiler. You can call into other-language modules from your C/C++ programs if you take into account differences in calling conventions and naming conventions among different languages. Often, these differences can be resolved by declaring other-language functions in C/C++ with keywords, such as _stdcall and extern "C".
from msdn
from msdn
#2
Calling conventions
Modifier Push parameters Pop parameters Name change (only in C)
__cdecl1 Right to left Caller '_' prepended
__fastcall Left to right Callee '@' prepended
__pascal Left to right Callee Uppercase
__stdcall Right to left Callee No change
Modifier Push parameters Pop parameters Name change (only in C)
__cdecl1 Right to left Caller '_' prepended
__fastcall Left to right Callee '@' prepended
__pascal Left to right Callee Uppercase
__stdcall Right to left Callee No change
#3
能不能详细点,我感觉好象比较难懂呀
#4
将函数的调用规则指定为标准的C方式。
对于不同的语言,函数的调用规则可能有些不同,主要是各参数的压栈序顺序不同。
比如有的语言再编译为最终代码时将各参数从左向右依次压栈,有的则正好相反,
从右向左压栈。
在用C语言和其他语言进行混合编程时,如果两者的顺序不一样,为了保证调用正常进行,
就要用到一些这样的声明。
对于不同的语言,函数的调用规则可能有些不同,主要是各参数的压栈序顺序不同。
比如有的语言再编译为最终代码时将各参数从左向右依次压栈,有的则正好相反,
从右向左压栈。
在用C语言和其他语言进行混合编程时,如果两者的顺序不一样,为了保证调用正常进行,
就要用到一些这样的声明。
#5
xiexie
#1
Rather than rewrite your Fortran or assembly language code, you should call your existing code from within Visual C++. Your functions and subroutines can reside in a separate module and be compiled on your native compiler. You can call into other-language modules from your C/C++ programs if you take into account differences in calling conventions and naming conventions among different languages. Often, these differences can be resolved by declaring other-language functions in C/C++ with keywords, such as _stdcall and extern "C".
from msdn
from msdn
#2
Calling conventions
Modifier Push parameters Pop parameters Name change (only in C)
__cdecl1 Right to left Caller '_' prepended
__fastcall Left to right Callee '@' prepended
__pascal Left to right Callee Uppercase
__stdcall Right to left Callee No change
Modifier Push parameters Pop parameters Name change (only in C)
__cdecl1 Right to left Caller '_' prepended
__fastcall Left to right Callee '@' prepended
__pascal Left to right Callee Uppercase
__stdcall Right to left Callee No change
#3
能不能详细点,我感觉好象比较难懂呀
#4
将函数的调用规则指定为标准的C方式。
对于不同的语言,函数的调用规则可能有些不同,主要是各参数的压栈序顺序不同。
比如有的语言再编译为最终代码时将各参数从左向右依次压栈,有的则正好相反,
从右向左压栈。
在用C语言和其他语言进行混合编程时,如果两者的顺序不一样,为了保证调用正常进行,
就要用到一些这样的声明。
对于不同的语言,函数的调用规则可能有些不同,主要是各参数的压栈序顺序不同。
比如有的语言再编译为最终代码时将各参数从左向右依次压栈,有的则正好相反,
从右向左压栈。
在用C语言和其他语言进行混合编程时,如果两者的顺序不一样,为了保证调用正常进行,
就要用到一些这样的声明。
#5
xiexie