動態載入一
cd src/maple
cp note.c ../so/
編輯 src/maple/Makefile
把 SRC 的 note.c 和 OBJ 的 note.o 拿掉
編輯 menu.c
加上
“bin/note.so:Note”, PERM_SYSOP|PERM_BM, - M_XMODE,
“Note 測試”,
make clean
./cb.sh
編輯 src/so/Makefile
把 SO加上 note.so
./cb.sh
動態載入二
編輯 so/note.c
int
NoteXO()
{
XO *xo;
char fpath[64];
utmp_mode(M_OMENU);
sprintf(fpath, “etc/notetest”);
xz[XZ_OTHER - XO_ZONE].xo = xo = xo_new(fpath);
xz[XZ_OTHER - XO_ZONE].cb = note_cb;
xover(XZ_OTHER);
free(xo);
return XO_INIT;
}
return 要是 XO_INIT 才能重繪
編輯 src/maple 下想出現的地方檔案 ex: talk.c
找到 KeyFunc * _cb[] = 要使用的地方 ex : KeyFunc ulist_cb[] =
加上
‘Q’ | XO_DL, (int (*)())”bin/note.so:NoteXO”,
// 按鈕 | 代表動態載入, 強制轉型成 int function 的程式進入點
// ‘h’ help 一定要在最後
./cb.sh
加入子 MENU
編輯 src/menu.c
加入
static MENU menu_test[] =
{
“bin/note.so:Note”, PERM_SYSOP|PERM_BM, - M_XMODE,
“Note 測試”,
menu_main, PERM_MENU + ‘N’, M_XMENU,
“遊客服務”
// 上層目錄, 一開始預設游標指到的位置, 代表是 MENU 相關定義可看
src/maple/modes.c
};
在要顯示 MENU 的部分加上 ex :
static MENU menu_main[] =
{
menu_test, PERM_SYSOP|PERM_BM, M_XMENU,
“Note 測試”,
// menu_test 要在此之前宣告
}
No comments:
Post a Comment