关于c#中DllImport调用托管代码出现找不到入口
在调用c#自己编写的dll找不到入口呢?代码如下:dll内容:
namespace MyTest
{
     public class Test
     {
         public  string StrSum = "";
         public  void Sum(int a, int b)
         {
             StrSum = (a + b).ToString();
         }
         public  string GetSum()
         {
             return StrSum;
         }
     }
}
页面后台代码:
public partial class _Default : System.Web.UI.Page
{
     [DllImport("MyTest.dll", EntryPoint = "Sum")]
     private static extern void Sum(ref int a, ref int b);
     [DllImport("MyTest.dll", EntryPoint = "GetSum")]
     private static extern string GetSum();
     protected void Page_Load(object sender, EventArgs e)
     {
         int a = 6;
         int b = 9;
         Sum(ref a,ref b);
         Response.Write(GetSum());
     }      
}
------解决方案--------------------c# 写的不能用dllimport 用 引用,或反射
------解决方案--------------------DllImport 引用的是非托管代码的dll
------解决方案--------------------C#写的不行 vc写的可以用DllImport这样调用。
------解决方案--------------------
DllImport  指示该特性化方法由非托管动态链接库 (DLL) 作为静态入口点公开。