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)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《C#调用DLL入门方法》
文章链接:https://www.skykkk.com/archives1948.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

相关推荐

  • 暂无文章