有关P/Invoke的一个问题.
MSDN上有个P/Invoke的例子,用C#代码调用C写的dll. 
 我在VS   2005上试了,新建一个解决方案,然后新建一个C++   Class   Library,新建一个C#   Console   Project,并且把C++的项目添加到了C#项目的引用中. 
 C#中代码: 
 [DllImport( "Demo.dll ")] 
 public   static   extern   int   GetExtn(int   x);   
 C++中代码: 
 int   __declspec(dllexport)   GetExtn(int   x)   {   return   17020   +   x;   }   
 可是调用的时候,总说在该DLL中找不到名为GetExtn的入口点;用depends查了一下,发现函数名称很奇怪,是?GetExtn%A...什么的,需要Undecorate才能看到函数名,但是User32.dll却无论如何都是直接的函数名称.   
 之前看到人说C++编译的时候编码不一样,调用函数名也不一样,可是我用过CharSet.Unicode,Auto,什么的,都不行~~C++工程编译的时候,选择编码是Unicode.到底应该怎么做?哪位达人给个参考,最简单的调用例子就行了~~十分感谢~~
------解决方案--------------------extern  "C " int  __declspec(dllexport) __stdcall GetExtn(int x) { return 17020 + x; } 
 实实