请教dll的基本问题
用的源程序是用c写的,我现在想把它做成dll,方便以后调用,中间出现一些问题。由于是第一次写dll,有些东西摸不着头脑
我在所有的.c文件第一行用了
#define MP2DLL_API _declspec(dllexport)
#include "Mp2dll.h"
然后再mp2dll.h中
#ifdef MP2DLL_API
#else
#define MP2DLL_API _declspec(dllimport)
#endif
然后把程序中的一个定义了很多宏的文件的代码写在下面,
#define 。。。
typedef struct bit_stream_struc
{
FILE *pt; /* pointer to bit stream device */
unsigned char *buf; /* bit stream buffer */
int buf_size; /* size of buffer (in number of bytes) */
long totbit; /* bit counter of bit stream */
int buf_byte_idx; /* pointer to top byte in buffer */
int buf_bit_idx; /* pointer to top bit of top byte in buffer */
int mode; /* bit stream open in read or write mode */
int eob; /* end of buffer index */
int eobs; /* end of bit stream flag */
char format;
/* format of file in rd mode (BINARY/ASCII) */
}
Bit_stream_struc;
把想输出的函数,有很多函数
MP2DLL_API void *mem_alloc (unsigned long block, char *item);
编译的时候出了很多错误,
error C2061: syntax error : identifier 'FILE'
bit_stream_struc' : 'struct' type redefinition
等很多这种,难道头文件重复包含,会重定义??还是其他别的情况