etherealのプラグインの練習
#include "stdafx.h" #include "rdcmd.h" #include "moduleinfo.h" #define G_MODULE_EXPORT #ifndef ENABLE_STATIC G_MODULE_EXPORT char version[] = VERSION; #endif /*------------------------------------------------*/ static int proto_rdcmd = -1; /*------------------------------------------------*/ static void proto_register_rdcmd(void) { MessageBox(NULL,"俺だよオレオレ", "", 0); return; } static void proto_reg_handoff_rdcmd(void) { MessageBox(NULL,"フリコメ", "", 0); return; } /*------------------------------------------------*/ #ifndef ENABLE_STATIC G_MODULE_EXPORT void plugin_register(void) { /* register the new protocol, protocol fields, and subtrees */ if (proto_rdcmd == -1) { /* execute protocol initialization only once */ proto_register_rdcmd(); } } G_MODULE_EXPORT void plugin_reg_handoff(void) { proto_reg_handoff_rdcmd(); } #endif
#define G_MODULE_EXPORT __declspec(dllexport)は .def使うのでいらなす
const gchar は exportできないから charに変更
以下 .defファイル
; rdcmd.def : DLL のモジュール パラメータを宣言します。 LIBRARY "rdcmd" EXPORTS ; 明示的なエクスポートはここへ記述できます plugin_reg_handoff @1 plugin_register @2 version @3