动态连接库里函数原型
char *decodestr Decode( char *Codeingstr); 我的定义:
[DllImport("convert.dll", EntryPoint = "Decode", CallingConvention = CallingConvention.StdCall)]
public static extern String Decode(String input); 为什么我调用Decode()返回的总是0000000000,不知是什么原因?请大家帮忙看看!
是不是返回值字符指针不是对应C#的String
char *decodestr Decode( char *Codeingstr); 我的定义:
[DllImport("convert.dll", EntryPoint = "Decode", CallingConvention = CallingConvention.StdCall)]
public static extern String Decode(String input); 为什么我调用Decode()返回的总是0000000000,不知是什么原因?请大家帮忙看看!
是不是返回值字符指针不是对应C#的String
http://msdn.microsoft.com/library/CHS/cpguide/html/cpconStringsSample.asp
function Coding(input:string):pchar;
stdcall;far;external 'convert.dll'name 'Coding';
function Decode(input:string):pchar;
stdcall;far;external 'convert.dll'name 'Decode';
那应该是dll api的问题
[DllImport("ConvertDll.dll", EntryPoint = "Decode",
CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern string Decode([MarshalAs(UnmanagedType.AnsiBStr)]string input);
单步执行是正确,直接运行出现外部组件发生异常。不知道为什么?