有关制作DLLFile的问题 [英] Problem about Making of DLLFile

查看:56
本文介绍了有关制作DLLFile的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用VC ++ 6.0制作了DLl

Dll的头文件

I made a DLl with VC++6.0

head file of Dll

/////////////////////////////
//                         //
//          DLL.h          //
//                         //
/////////////////////////////

#ifdef      __cplusplus
        
#define     EXPORT extern "C" __declspec (dllexport)
        
#else
        
#define     EXPORT __declspec (dllexport)
        
#endif


typedef tagSTRING_A  //For ANSI
{
char * str ;
int    i ;
}STRING_A ;

typedef tagSTRING_W  //For UNICODE
{
wchar_t * str ;
int       i ;
}STRING_W ;

#ifdef UNICODE

#define STRING STRING_W

#else

#define STRING STRING_A

#endif



我在新项目中使用了Dll
(
dll.lib \\在新项目库中包含lib
dll.h \\包含在新项目的源文件中
dll.dll \\我将其复制到新项目的Debug-directroy
)

新项目源



I use the Dll in a new project
(
dll.lib \\ include lib in new project library
dll.h \\ include in source-file of new project
dll.dll \\ I copy it at Debug-directroy of new projcet
)

New Project Source

///////////////////////
//                   //
//     project.c     //
//                   //
///////////////////////

#include <windows.h>
#include "dll.h"

STRING str ;
</windows.h>



我的问题是:
当我输入"str."时在源代码中,为什么VC ++ 6.0不显示STRING成员的帮助菜单?

通常,当我们输入struct-variable和."的名称时,vc ++ 6.0将显示help = menu的名称.
我们可以按向下箭头或向上箭头选择成员.

希望有人给我提示



My problem Is:
when I inputed "str." in source, why VC++6.0 doesnt show help-Menu of member of STRING ?

generally vc++6.0 will show the memeber of help=menu when we input a name of struct-variable and ".".

and we can press Arrow down or Arrow Up to select memeber.

wish someone give me hints

推荐答案

首先,如果要编译DLL,则必须导出;如果要使用DLL进行编译,则必须导入.
我不确定DLL中的#define VC6做了什么标记,但是VS08使用_USRDLL.
您可以通过转到DLL的项目属性,然后转到C/C ++,然后是预处理器来找到它.
如果其中没有似乎可以编译DLL的定义,则添加您自己的_USRDLL
Firstly You must export if you are compiling the DLL, or import if you are compiling something using the DLL.
I am not sure what #define VC6 does in the dll to mark this, but VS08 uses _USRDLL.
You can find this by going to the project properties for the DLL then going to the C/C++ then Preprocessor.
If there isnt something in there that seems to be a definition for compiling the DLL add your own _USRDLL
/////////////////////////////
//                         //
//          DLL.h          //
//                         //
/////////////////////////////

#if defined(_USRDLL) || defined(_DLL)
	#ifdef __cplusplus
		#define PORT extern "C" __declspec(dllexport)
	#else
		#define PORT __declspec(dllexport)
	#endif
#else
	#ifdef __cplusplus
		#define PORT extern "C" __declspec(dllimport)
	#else
		#define PORT __declspec(dllimport)
	#endif
#endif


typedef tagSTRING_A { //For ANSI
	char *str;
	int   i;
} STRING_A;
typedef tagSTRING_W { //For UNICODE
	wchar_t *str;
	int      i;
} STRING_W;

#ifdef UNICODE
	#define STRING STRING_W
#else
	#define STRING STRING_A
#endif



我不知道为什么它不检测数据类型.您的符号数据库可能有问题,VS08有时会出现此问题.

我不确定VC6使用的文件扩展名是什么,但是在主项目目录中应该有一个包含所有符号的文件(VS08中为< workspace name ="> .ncb).如果您关闭解决方案并删除(或更好地重命名)此文件,Visual Studio将重新创建该文件,希望能消除任何错误.



I dont know why it isn''t detecting the data type. It could be an issue with your symbols database, VS08 occasionally has this problem.

Im not sure what file extension VC6 uses, but in the main project directory there should be a file (<workspace name="">.ncb in VS08) that holds all the symbols. If you close your solution and delete (or better, rename) this file, Visual Studio will recreate it, hopefully getting rid of any errors.


尝试进行干净/完整的解决方案重建(所有项目). VC6中的Intellisense并不是那么好.在VC ++ 2010中,它已经有了更好的改进(如果有的话).
Try doing a clean/full rebuild of the solution (all projects). Intellisense in VC6 was not that great. It has considerably got better in VC++ 2010 (if you have that).


我找到了解决此问题的结构的方法.

它应该使用 "typedef"
I found solution of struct of this problem.

it should use "typedef"
typedef tagSTRING_A { //For ANSI
        char * str ;
        int    i ;}
STRING_A ;

typedef tagSTRING_W { //For UNICODE
        wchar_t * str ;
        int       i ;
}STRING_W ;

#ifdef UNICODE

typedef STRING_W STRING ; 
//use "typedef" not "#define" and dont forget " ; " at End of sentence
  
#else

typedef STRING_A STRING ;

#endif



如果这样做,则在输入str时. (STRING str),将弹出会员帮助菜单.

我将继续找出功能的解决方案



if do like this , when you input str. (STRING str), the memeber help-menu will pop up.

and I will continue find out the solution of function


这篇关于有关制作DLLFile的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆