[英]unsigned short * and wchar_t error in C++
I'm using VS2008 to make an C++ DLL for Fljs which is js used by Adobe Flash. 我正在使用VS2008为Fljs创建C ++ DLL,这是Adobe Flash使用的js。
The hell function need an arg with type of unsigned short *
used for register function name in js. hell函数需要一个
unsigned short *
类型的arg,用于js中的注册函数名称。
I use the sample successfully do some simple operations in js.It pass the arg use _T("functionname")
我使用示例成功地在js中执行了一些简单的操作。它通过arg use
_T("functionname")
But the sample is C code.When I use C++ code(just change the .c to .cpp), VS tell me wchar_t
is inner type, so I turn the option off and now the wchar_t
is typedef of unsigned short. 但是示例是C代码。当我使用C ++代码(只需将.c更改为.cpp)时,VS告诉我
wchar_t
是内部类型,因此我关闭了该选项,现在wchar_t
是unsigned short的typedef。
Then compile it without error.But in js , it can't find the function name. 然后编译它没有错误。但是在js中,它找不到函数名称。
So I want to know why the js can't find the name? 所以我想知道为什么js找不到名称? What had been done with the
wchar_t
which is both typedef of unsigned short
in C and C++? 在C和C ++中,
wchar_t
都是unsigned short
typedef, wchar_t
做了什么?
Most likely your function names are now mangled if you switch to C++ and don't flag the exported functions as C style. 如果您切换到C ++并且不将导出的函数标记为C样式,则很可能现在已经弄乱了函数名。
You can see an explanation here on MSDN 您可以在MSDN上看到解释
What you can try is to make them C again. 您可以尝试使它们再次变为C。
extern "C" { // only need to export C interface if
__declspec( dllimport ) void MyCFunc();
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.