欢迎光临
我们一直在努力

C#调用DLL入门方法

简C#调用DLL代码:C#调用DLL入门方法using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;namespace Csharp_Delphi_DLL_DEMO1{    public partial class Form1 : Form    {        [DllImport("dll1.dll", EntryPoint = "Triple")]        static extern int Triple(int i);        public Form1()        {            InitializeComponent();        }        private void Form1_Load(object sender, EventArgs e)        {        }        private void button1_Click(object sender, EventArgs e)        {            int i = int.Parse(textBox1.Text);            label1.Text = Convert.ToString(Triple(i));        }    }}须要加入命名空间:using System.Runtime.InteropServices;DLL文件代码:library dll1;uses  SysUtils,  Classes,  Dialogs;{$R *.res} //建立过程function Triple(N:Integer):integer;stdcall;begin       result:=N+3;end;//输出exports  Triple;beginend.

赞(0)
未经允许不得转载:福利吧|福利社|fuliba » C#调用DLL入门方法

相关推荐

  • 暂无文章