有一个c++编写的dll,其头文件如下:
#ifndef _FILECLIENT_H_
#define _FILECLIENT_H_
#ifdef  __cplusplus
extern  "C" {
#endif#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#ifdef  WIN32
#include <io.h>
#include <direct.h>
#include <sys/stat.h>
#include <winsock2.h>
#endif/******************************************************************************
宏定义区域
 ******************************************************************************/
#define MAXSIZE 4096
#define FILE_SEND 0 /* 发送文件*/
#define FILE_RECV 1 /* 接收文件*/
#define FILE_ASK 2 /* 请求*/
#define FILE_ACK 3 /* 确认*/
#define FILEDATA_END 4 /* 成功结束*/
#define FILE_FAIL 5 /* 失败*/#define RC_SUCCESS 0
#define RC_FAILURE -1
/******************************************************************************
数据结构和类型定义区域
 ******************************************************************************/
typedef struct _stData
{
long m_lFlag;
char m_szBuf[MAXSIZE + 1];
}STData;/******************************************************************************
client.c
 ******************************************************************************/
#ifdef  WIN32
extern int InitSocketEnv();
extern void UnInitSocketEnv();
#endifextern void uftsv_SetError(const char *, ...);extern int socki_ConnectServer(char*, long);extern void sockv_Close(int);extern long sockl_Read(int, char*, long);extern long sockl_Write(int, char*, long);extern long filel_Write(int, STData*);extern long filel_Read(int, STData*);extern int socki_ConnectServer(char* in_pszIP, long in_lPort);extern long    ucl_UploadFile(char*, long, char*, char*, char*);extern long ucl_DownloadFile(char*, long, char*, char*, char*);extern long clil_TranFile(long, char*, long, char*, char*, char*);#ifdef __cplusplus
}
#endif
#endif  /*  _FILECLIENT_H_*/--------------------------------------------------------------------------
我在c#里调用其任何一个方法都报找不到入口点,调用代码如下:
[DllImport("fileclient", EntryPoint = "clil_TranFile", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void clil_TranFile(long in_iTransFlag, string in_pszIP, long in_lPort, 
            string in_pszLocalFile, string in_pszRemoteFile, StringBuilder out_pszError);public void Test()
{
    clil_TranFile(1, "", 80, "", "", new StringBuilder(""));
}大家帮忙看下!!!!

解决方案 »

  1.   

    先用工具看看dll是不是标准导出 也就是编译的时候extern "C" 宏开了没有  如果不是标准导出会报错
      

  2.   

    你在别的开发工具调用你的DLL,看是否有错
      

  3.   

    return value is   long 
     extern long clil_TranFile(long, char*, long, char*, char*, char*); 
      

  4.   

    return value is   long type
     extern long clil_TranFile(long, char*, long, char*, char*, char*); 
      

  5.   

    改成了long型,也没用啊,老是提示找不到clil_TranFile入口点,我用Depends.Exe打开dll,看不到一个函数名称.
      

  6.   

    函数名应该发生改变了
    你用dumpbin /exports 库名.dll
    看一下吧