//以下是调用jiemi.dll里面 jiemi()函数的声明写法
//相当于易语言中的 DLL命令定义表, 包含了文件路径 函数名 参数 数据类型等等
[DllImport("jiemi.dll")] //这里也可以改成完整路径
public static extern string jiemi(string a, string b);
public static extern string MyFunction2(string a, string b);
public static extern string MyFunction3(string a, string b);
public static extern string MyFunction4(string a, string b);
/*声明完了就可以调用了~*/完整代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("jiemi.dll")] //可以改成完整路径
public static extern string jiemi(string a, string b);
private void button1_Click(object sender, EventArgs e)
{
textBox2.Text= jiemi(textBox1.Text, "123456");
}
}
}