vc6编写的dll程序
extern "C" _declspec(dllexport)  bool  ReadString(LPCSTR lpString)
{
....
}
*.def文件
EXPORTS
ReadString
VB中的程序:
Private Declare Function ReadString Lib "commication.dll" (ByVal send As String) as Boolean
调用时返回49,DLL调用约定错误
后改为
extern "C" _declspec(dllexport)  bool  __stdcall ReadString(LPCSTR lpString)
{
....
}
其他不变,调用时返回453,没有入口。拼写肯定没有错误。用dumpbin看,输出_ReadString@16,可是我写*.def文件了,也用extern "C"了。我把文件名改为*.c也不可以。
我都是照网上写的作的呀!

解决方案 »

  1.   

    试试
    Private Declare Function ReadString Lib "commication.dll" (ByVal send As String) as Long

    Private Declare Function ReadString Lib "commication.dll" (ByVal send As Any) as Long
      

  2.   

    extern "C" _declspec(dllexport) 去掉后再编译bool  __stdcall ReadString(LPCSTR lpString)
    {
    ....
    }Declare Function ReadString Lib "commication.dll" (ByVal send As String) as Byte
      

  3.   

    我试了,还是不可以。
    我理解是不加__stdcall,调用约定错误,但是加了以后输出就不对了.变为c++输出了。大家帮帮,看看我该怎么办。
      

  4.   

    3楼的兄弟
    我去掉extern "C" _declspec(dllexport) 后,编译出的dll,用dumpbin看exports没有输出呀。是不是我的def文件有问题?
      

  5.   

    顶一下!def文件名,有没有什么要求?
      

  6.   

    好像用了extern "C"就不要用DEF文件,两个中选一个就行了,不要两个都同时存在。
      

  7.   

    def文件里面是不是就写一个
    EXPORTS
    FunName
    就可以了?library libname.dll是不是必须的?
      

  8.   

    必须要这样的格式LIBRARY   BTREE
    DESCRIPTION "Implements a binary tree."  <-- 可选
    EXPORTS
       Insert   @1
       Delete