国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C++ > 正文

c#調用c++寫成的dll文件,返回char*,返回數組,用ref接收,byte[] (zz)

2019-11-06 07:41:13
字體:
來源:轉載
供稿:網友
/ Inclusion guard#ifndef _DLLTUT_DLL_H_#define _DLLTUT_DLL_H_// Make our life easier, if DLL_EXPORT is defined in a file then DECLDIR will do an export// If it is not defined DECLDIR will do an import#if defined DLL_EXPORT#define DECLDIR __declspec(dllexport)#else#define DECLDIR __declspec(dllimport)#endif// Specify "C" linkage to get rid of C++ name mangelingextern "C"{    // Declare 2 functions    DECLDIR int Add( int a, int b );    DECLDIR void Function( void );    DECLDIR void GetPRt( char * prtStr );}// End the inclusion guard#endif      static void Main(string[] args)        {            test.Function();            Console.WriteLine("result: " + test.Add(2, 3).ToString());            //string str = "aaddddddddddd";            byte[] str = new byte[12];            test.GetPrt(ref str[0]);            Console.WriteLine(System.Text.Encoding.GetEncoding("GB2312").GetString(str));            Console.ReadLine();        }    }    class test    {        [DllImport("..//..//lib//DLLTest.dll")]        public static extern  void Function();         [DllImport("..//..//lib//DllTest.dll")]        public static extern int Add(int i,int j);        [DllImport("..//..//lib//DllTest.dll")]        public static extern void GetPrt(ref byte prtStr);    }
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 昆山市| 长泰县| 洛南县| 新津县| 莱西市| 陵川县| 七台河市| 阿克陶县| 呼伦贝尔市| 安丘市| 韶关市| 邹城市| 平武县| 阳曲县| 阜南县| 丰城市| 重庆市| 二连浩特市| 瑞丽市| 卓资县| 天门市| 扎赉特旗| 连山| 稷山县| 温泉县| 潼南县| 花垣县| 新营市| 句容市| 棋牌| 嵩明县| 桦川县| 东源县| 怀安县| 祁阳县| 清远市| 东乌| 新田县| 五寨县| 青田县| 平舆县|