• 大小: 1.02MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-16
  • 语言: C/C++
  • 标签:

资源简介

c#调用c++DLL,DLL里是二维数组 ,c#里如何调用二维数组

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;


namespace ConsoleApplication2
{
    
        
       [StructLayoutAttribute(LayoutKind.Sequential CharSet = CharSet.Ansi)]
        public struct SvrInfo
        {
            [MarshalAs(UnmanagedType.ByValArray SizeConst = 3 * 16)]
            public char[]  csStrMIP;
        }

    class Program
    {
        [DllImport(“tet2.dll“)]
        static extern int Loginref SvrInfo info);

        static void Main(string[] args)
        {

            SvrInfo si = new SvrInfo();
            si.csStrMIP = new char[48];

            Loginref si);

            Console.WriteLine(si.csStrMIP[0]);
            Console.WriteLine(si.csStrMIP[16]);
            Console.WriteLine(si.csStrMIP[32]);

        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-03-16 12:58  c#调用c++DLL\
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\
     文件         947  2011-03-16 12:48  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2.sln
     文件       12800  2011-03-18 09:22  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2.suo
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\Debug\
     文件        5120  2011-03-16 12:52  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.exe
     文件       11776  2011-03-16 12:52  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.pdb
     文件       14328  2011-03-18 09:21  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.vshost.exe
     文件         490  2007-07-21 01:33  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.vshost.exe.manifest
     文件      200748  2011-03-16 12:55  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\Debug\tet2.dll
     文件      255632  2011-03-16 12:55  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\bin\Debug\tet2.ilk
     文件        2511  2011-03-16 12:48  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.csproj
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\obj\
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\obj\Debug\
     文件         632  2011-03-18 09:21  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\obj\Debug\ConsoleApplication2.csproj.FileListAbsolute.txt
     文件        5120  2011-03-16 12:52  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\obj\Debug\ConsoleApplication2.exe
     文件       11776  2011-03-16 12:52  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\obj\Debug\ConsoleApplication2.pdb
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\obj\Debug\TempPE\
     文件         879  2011-03-16 12:52  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\Program.cs
     目录           0  2011-03-16 12:58  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\Properties\
     文件        1394  2011-03-16 12:48  c#调用c++DLL\ConsoleApplication2\ConsoleApplication2\Properties\AssemblyInfo.cs
     目录           0  2011-03-16 12:58  c#调用c++DLL\tet2\
     目录           0  2011-03-16 12:58  c#调用c++DLL\tet2\Debug\
     文件       54772  2011-03-16 12:55  c#调用c++DLL\tet2\Debug\StdAfx.obj
     文件      200748  2011-03-16 12:55  c#调用c++DLL\tet2\Debug\tet2.dll
     文件         528  2011-03-16 12:55  c#调用c++DLL\tet2\Debug\tet2.exp
     文件      255580  2011-03-16 12:55  c#调用c++DLL\tet2\Debug\tet2.ilk
     文件        1876  2011-03-16 12:55  c#调用c++DLL\tet2\Debug\tet2.lib
     文件        2464  2011-03-16 12:55  c#调用c++DLL\tet2\Debug\tet2.obj
............此处省略13个文件信息

评论

共有 条评论

相关资源