//dll函数定义 namespace testdll { public class AddClass { public static long Add(long i, long j) { return (i + j); } } }//调用dll的程序 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices;namespace adf { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("testdll.dll", EntryPoint = "add")] public static extern long Add(long i, long j); private void button1_Click(object sender, EventArgs e) { MessageBox.Show(Add(23, 23).ToString()); //不用IDE里的引用报错 testdll.AddClass.Add(23, 23);//如果在IDE里用引用DLL可以。 } } }以上代码为什么我在VS IDE里引用testdll.dll可以使用testdll.AddClass.Add(23,23)而使用[DllImport("testdll.dll", EntryPoint = "add")] public static extern long Add(long i, long j);就会提示“无法在 DLL“testdll.dll”中找到名为“add”的入口点。”
namespace testdll
{
public class AddClass
{
public static long Add(long i, long j)
{
return (i + j);
}
}
}//调用dll的程序
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;namespace adf
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("testdll.dll", EntryPoint = "add")]
public static extern long Add(long i, long j);
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(Add(23, 23).ToString()); //不用IDE里的引用报错
testdll.AddClass.Add(23, 23);//如果在IDE里用引用DLL可以。
}
}
}以上代码为什么我在VS IDE里引用testdll.dll可以使用testdll.AddClass.Add(23,23)而使用[DllImport("testdll.dll", EntryPoint = "add")]
public static extern long Add(long i, long j);就会提示“无法在 DLL“testdll.dll”中找到名为“add”的入口点。”
您好,c#写的DLL 下面那些可以调用
delphi,vb,c/c++,asp,pb,
*****************************************************************************
欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
2 NET的DLL没有用其它语言调用过,不过我分析使用是可行,但是兼容性是否稳定就很难说了。
那c#是不是不能写非托管代码的dll
===================================
对那非托管代码怎么访问托管代码呢?
===========================
把托管代码包装成com的,
那DELPHI调用C#的DLL也要写成COM?
我在VS2005里新建windows控件库,这样的项目编译出来算不算是COM,DELPHI里可以直接用吗?
到底怎么样才算是包装成COM了,新手,问题比较多,呵呵