C# 调用dll的时候,要根据dll的来源选择不同的调用方式。
(1)非C#语言编写的dll,比如调用Delphi、Java等语言编写的dll:
第一步, using System.Runtime.InteropServices;
第二步,声明并静态调用,如下所示:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
namespace MACADDR
{
public class ComputerHepler
{
[DllImport("Iphlpapi.dll")]
private static extern int SendARP(Int32 dest, Int32 host, ref Int64 mac, ref Int32 length);
[DllImport("Ws2_32.dll")]
private static extern Int32 inet_