使用c#在asp.net中使用C ++ dll [英] Using C++ dll in asp.net using c#

查看:65
本文介绍了使用c#在asp.net中使用C ++ dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下链接创建了一个c ++ dll



http://msdn.microsoft.com/en-us/library/ms235636.aspx [ ^ ]





现在我想用它在我的asp.net网站上。

在我的默认页面上我使用了标签和一个按钮。

点击按钮我希望看到结果。

我这样使用它:



 使用 System.Runtime.InteropServices; 

public partial class _Default:System.Web.UI.Page
{

[DllImport( MathFuncsDll.dll,EntryPoint = 添加)]
public static extern double 添加( double x, double y);



受保护 void Page_Load( object sender,EventArgs e)
{

}
protected void Button1_Click( object sender,EventArgs e)
{
Label1.Text =添加( 2 2 3 4 )。ToString();

}
}







我已经引用了dll



但是我得到一个错误启用来查找dll。请帮助

解决方案

将DLL放在您使用它组装的目录中。



-SA

I created a c++ dll using a following link

http://msdn.microsoft.com/en-us/library/ms235636.aspx[^]


Now I want to use it in my asp.net website.
on my default page I have use a label and a button .
on clicking button I want to see the result.
I am using it like that:

using System.Runtime.InteropServices;

public partial class _Default : System.Web.UI.Page
{

    [DllImport("MathFuncsDll.dll", EntryPoint = "Add")]
    public static extern double Add(double x, double y);



    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = Add(2.2, 3.4).ToString();

    }
}




I have already referenced that dll

But I got an error enable to find the dll. please help

解决方案

Put the DLL in the directory where you assembly using it is.

—SA


这篇关于使用c#在asp.net中使用C ++ dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆