日期:2014-05-17  浏览次数:20806 次

C# 调用自己写的DLL 文件一直报错说无法找到入口点,求大神帮忙
 DLL 文件代码(就是输入的两个值对换):
 namespace MAXCD
{
    public class Class1
    {
          public static long Swap(ref long i,ref long j) 

          { 
             int k;
           
            K = i;

            i=j;
            j=k;
            return i;
            return j;

          }
    }

生成的DLL 文件名为KC;
主程序代码:

using System.Runtime.InteropServices; //

namespace MAXCD
{
    class Class1
    {

        [DllImport("KC.dll", EntryPoint = "Swap")]
        public static extern long Swap(ref long i, ref long j);
    }
}

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; //
using MAXCD;


namespace _22
{
    public partial class Form1 : Form
    {

        [DllImport("user32.dll", EntryPoint = "MessageBoxA")]

        static extern int MsgBox(int hWnd, string msg, string caption, int type);


        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }