私は、RoofExp と testapp の 2 つのプロジェクトを持っています。RoofExp は、C で記述された DLL プロジェクトです。testapp は、RoofExp.dll をテストするための win32 コンソール プロジェクトです。私のコードは以下のとおりです。
ルーフexp.h
#ifndef ROOF_EXP_PARSER_H
#define ROOF_EXP_PARSER_H
#ifdef ROOF_EXP_API
#else
#define ROOF_EXP_API __declspec(dllimport)
#endif
#ifndef MAX_PATH
#define MAX_PATH 260
#endif
#define MAX_PARAS 16
enum ParaType
{
PARA_NUMBER = 1,
PARA_STRING
};
typedef struct _VARIABLE_INFO
{
char VarName[MAX_PATH];
struct _VARIABLE_INFO *next;
}VARIABLE_INFO, *PVARIABLE_INFO;
typedef struct _FUNCTION_INFO
{
char FuncName[MAX_PATH];
int FuncParas;
enum ParaType FuncParaType;
int FuncParaList[MAX_PARAS];
struct _FUNCTION_INFO *next;
}FUNCTION_INFO, *PFUNCTION_INFO;
ROOF_EXP_API void __cdecl ParserUninitialize();
ROOF_EXP_API int __cdecl ParserInitialize(PVARIABLE_INFO pVarList, PFUNCTION_INFO pFuncList);
ROOF_EXP_API int __cdecl ParserExecute(char *filename, int *errcnt, char *errmsg, int bufflen, void *fptr);
#define ERROR_PARSER_BASE 1024
#define ERROR_PARSER_SUCCESS 0x00
#define ERROR_PARSER_BAD_PARAMETERS ERROR_PARSER_BASE-1
#define ERROR_PARSER_FILE_NOT_FOUND ERROR_PARSER_BASE-2
#define ERROR_PARSER_FAILED_INIT ERROR_PARSER_BASE-3
#endif
testapp.cpp
int _tmain(int argc, _TCHAR* argv[])
{
char szFileName[MAX_PATH];
int nRetCode = 0;
ParserExecute(szFileName, &nRetCode, szFilePath, 1024, NULL);
return 0;
}
RoofExp プロジェクトは正常にビルドできます。testapp プロジェクトをビルドすると、次のエラー メッセージが表示されます。
error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl ParserExecute(char *,int *,char *,int,void *)
私は長い間グーグルで検索しましたが、問題を解決できません。誰かが私のコードの問題点とその解決方法を教えてもらえますか?