/* * 使用・複製・修正・配布に関する許諾条件: * 本ファイルは、以下の5条件が全て遵守される場合に限り、公序良俗に反しな * い範囲で、商用・非商用を問わず、いかなる個人または組織に対しても対価を * 支払うことなく、誰でも自由に、使用・複製・修正・配布の全部または一部の * 行為を行うことができる。 * * (1) この「使用・複製・修正・配布に関する許諾条件」にある文言を一切修正 * しないこと。 * * (2) ファイルの先頭部に記述してある author行および Copyright行または、 * そのいずれかを削除したり修正したりしないこと。ただし、author行また * は Copyright行で記述されている当の個人または組織 (以後、「著作者」 * と呼ぶ) は、自身に関する記述に限り、削除したり修正したりすることが * できる。 * * (3) ファイルに何らかの修正を加えた場合には、修正した個人または組織に関 * する author行と Copyright 行を追加することができる。その場合、追加 * された記述に対しても (2)項の規定が適用される。 * * (4) 本ファイルを使用、複製、修正または配布した結果として、いかなる種類 * の損失、損害または不利益が発生しても、「著作者」がその責を一切負わ * ないことに同意し、かつ「著作者」にその責を一切負わせないこと。 * * (5) 本ファイルをコンパイラに適用して得られたバイナリオブジェクトは、そ * のコンパイルを実行した個人または組織の所有物であり、「著作者」との * 間には、一切の権利・義務関係が存在しないことに同意する。 */ //----------------------------------------------------------------------------- // dll_sample.cpp : DLL アプリケーション用のエントリ ポイントを定義します。 // #include "stdafx.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } //----------------------------------------------------------------------------- #include "dll_sample_interface.h" #include "langedge/dll_support/buffer_body.hpp" using langedge::RemoteBufferBody; class DllSampleImpl : public DllSampleInterface { public: virtual int getInteger() const { return 100; } virtual RemoteBufferHandle<char>* getDllName() const; virtual void release() { delete this; } protected: // 必ず release() を介してデストラクトされるようにするため、 // 明示的に delete を呼べないようにする。 virtual ~DllSampleImpl() { } }; RemoteBufferHandle<char>* DllSampleImpl::getDllName() const { RemoteBufferBody<char>* buffer = new RemoteBufferBody<char>( getInteger() ); strcpy( buffer->begin(), "DllSample" ); return buffer; } //----------------------------------------------------------------------------- DllSampleInterface* createInstance() { return new DllSampleImpl(); } //----------------------------------------------------------------------------- int proc0() { return 0; } int proc1(int x1) { return x1; } int proc2(int x1, int x2) { return x1+x2; } int proc3(int x1, int x2, int x3) { return x1+x2+x3; } int proc4(int x1, int x2, int x3, int x4) { return x1+x2+x3+x4; } int proc5(int x1, int x2, int x3, int x4, int x5) { return x1+x2+x3+x4+x5; }
1.4.2