この DLL を機能可能にしようとしていますが、準備完了のコードからでも機能させることができません。
C ++(win32プロジェクト)でVisual Studioから単純なDLLを作成し、使用するこの2つのファイルを持っています。
headerZincSDK.h
// headerZincSDK.h
#pragma once
#include <string>
#include <vector>
#if defined( WIN32 )
#include <tchar.h>
#define mdmT( x ) _T( x )
#else
#define mdmT( x ) L ## x
#endif
extern void OnEntry();
extern bool RegisterModule( const std::wstring& strName );
typedef struct
{
int formId;
}
ZincCallInfo_t;
typedef std::wstring ( *ZINC_COMMAND_CALLBACK )( const ZincCallInfo_t& info, const std::vector< std::wstring >& );
extern bool RegisterCommand( const std::wstring& strModuleName,
const std::wstring& strCommandName,
ZINC_COMMAND_CALLBACK callback );
// Helper commands for returning values
std::wstring AsString( const std::wstring& str );
std::wstring AsInteger( int value );
std::wstring AsBoolean( bool value );
そして Main Project.cpp
// Project1.cpp
#include "stdafx.h"
#include "headerZincSDK.h"
using namespace std;
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
void OnEntry()
{
wstring moduleName = mdmT( "TestExt" );
RegisterModule( moduleName );
RegisterCommand( moduleName, mdmT( "random" ), Command1 );
RegisterCommand( moduleName, mdmT( "reverse" ), Command2 );
}
wstring Command1 (const ZincCallInfo_t& info, const vector< wstring >& vParams )
{
//My Code
}
wstring Command2 (const ZincCallInfo_t& info, const vector< wstring >& vParams )
{
//My Code
}
問題は、Command1 と Command2 が未定義であると表示され、ソリューションがビルドされないことです。
私はC ++に関する知識がまったくなく、これが私の最初のステップですが、多くのことを簡単に理解できます。
これらを機能させるには、これらの2つのファイルで何を変更すればよいか教えてもらえますか?