以下是引用sxzjbb在2023-8-30 10:57:14的发言:
一样的,同样写多个函数,然后在FoxInfo myFoxInfo[] = {
{"CTEST", (FPFI) CTest,0 , ""},
{"CTEST1", (FPFI) CTest1,0 , ""},
{"CTEST2", (FPFI) CTest2,0 , ""},
{"CTEST3", (FPFI) CTest3,0 , ""},
};
我用过,调用函数名CTEST(),具体忘了
可以的。
#include "pro_ext.h"
void FAR NewVarEx(ParamBlk FAR *parm)
{
char FAR *varName;
Locator loc;
int flag;
int retValue;
// Null 终止字符串
if (!_SetHandSize(parm->p[0].val.ev_handle,
parm->p[0].val.ev_length+1))
{
_Error(182); // "内存不足"
}
_HLock(parm->p[0].val.ev_handle);
varName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);
varName[parm->p[0].val.ev_length] = '\0';
loc.l_subs = parm->p[1].val.ev_long;
loc.l_sub1 = parm->p[2].val.ev_long;
loc.l_sub2 = parm->p[3].val.ev_long;
flag = parm->p[4].val.ev_long; //0 public 1 private
if ((retValue = _NewVar(varName, &loc, flag)) < 0){
// _NewVar() 返回负的 Visual FoxPro 错误号
_Error(-retValue);
}
_HUnLock(parm->p[0].val.ev_handle);
}
void TestAdd(ParamBlk FAR *parm)
{
int x1;
x1=parm->p[0].val.ev_long + parm->p[1].val.ev_long;
_RetInt(x1,10);
}
FoxInfo myFoxInfo[] = {
{"XNEWVAR", (FPFI) NewVarEx, 5, "C,I,I,I,I"},
{"TESTADD", (FPFI) TestAdd, 2, "I,I"}
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};
#define NV_PUBLIC
0
#define NV_PRIVATE
1
= xNewVar('var', 0, 0, 0, NV_PUBLIC) &&变量
DISPLAY MEMORY LIKE var
= xNewVar('onedim', 1, 5, 0, NV_PUBLIC) &&一维
DISPLAY MEMORY LIKE onedim
= xNewVar('twodim', 2, 5, 6, NV_PUBLIC) &&二维
[此贴子已经被作者于2023-8-30 12:40编辑过]