class Class1
    {
        [DllImport("aa.dll", EntryPoint = "mytest", CallingConvention = CallingConvention.StdCall)]
        public static extern int mytest();
    }
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(abc.Class1.mytest().ToString());
        }________________________   以上为c# 代码 ____________________________________
// 这是主 DLL 文件。#include "stdafx.h"#include "aa.h"
int mytest()
{
     return 1;
}__________________  在vs2005中建立的c++类库,以上为cpp代码   __________________________________错误:无法在 DLL“aa.dll”中找到名为“mytest”的入口点()

解决方案 »

  1.   

    dll代码都在上面...
    哪错了??给改下吗?
      

  2.   

    在dll工程中添加 def文件文件内容
     EXPORTS
    mytest
        ; 此处可以是显式导出
      

  3.   

     _declspec(dllexport)  int mytest() 

    return 1; 
      

  4.   

    错误 1 error LNK2001: 无法解析的外部符号 "mytest" d:\cc\aa\aa\rr.def 1 错误 2 fatal error LNK1120: 1 个无法解析的外部命令 D:\cc\aa\Debug\aa.lib
      

  5.   

    to zx005
    系统找不到mytest
      

  6.   

    你要先建一个DLL工程,不知道你建的是不是
      

  7.   

    to zx005
    我建立的是类库...按道理应该没有错..因为我也找到生成的dll文件了
    to jiezi316
    如何显示导出函数
      

  8.   

    #include "stdafx.h"_declspec(dllexport)  int mytest() 

    return 1; 

    你把这个直接编译
      

  9.   

    to zx005
    方法不行to ling3wei
    是dll有问题..
    怎么改
      

  10.   

    my.cpp(1) : fatal error C1034: stdafx.h: 不包括路径集
    报这错