您的位置:程序门 -> .net技术 -> c#



c# 调用dll函数 返回值为char*,怎么声明和调用??


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


c# 调用dll函数 返回值为char*,怎么声明和调用??
发表于:2007-09-14 15:24:39 楼主
dll中函数原型是const   unsigned   char*   test(int   number)

怎么在c#中声明和调用它?!!
发表于:2007-09-15 09:47:101楼 得分:0
求救!
发表于:2007-09-15 09:51:062楼 得分:0
在.net里面这样声明和调用
[dllimport( "xxx.dll ",   entrypoint   =   "_test ")]
                        public   static   extern     byte[]   test(int   number);


    byte[]   mydata=new   byte[64];
    mydata   =   xxxdll.test(1);

怎么老是提示cannot   marshal   'return   value ':   invalid   managed/unmanaged   type   combination.这个错误??
发表于:2007-09-15 09:52:073楼 得分:0
声明成intptr
剩下的工作参考marshal类
发表于:2007-09-15 09:56:134楼 得分:0
学习!帮顶


快速检索

最新资讯
热门点击