Translating lotus API Data Types to LotusScript

博客介绍了Lotus API函数参数传递规则。一般指针变量用ByRef传递,其他用ByVal,但字符串通常用ByVal,用户定义数据类型用ByRef。若要传NULL值,将参数声明为Integer并传零。还提及C函数返回值及声明在LotusScript中的处理。

lotus API Data TypeLotusScript Data Type
char, char*ByVal String
char far*ByVal String
intLong (4-byte value)
longLong
WORD, SWORDInteger
DWORDLong
INT, UINTInteger
SHORT, USHORTInteger
LONG, ULONGLong
NUMBERDouble
BOOLLong (in general,
sometimes Integer)
BYTE, BOOLBYTEByte in R5+,
cannot convert pre-R5
STATUSInteger
HANDLELong (Integer on Mac
and some UNIX)
HMODULELong
NULLByVal Integer (0)

In general, when you have a pointer (*) to a variable, you'll want to pass that parameter ByRef, otherwise you should pass it ByVal -- the exceptions are Strings (which you should pretty much always pass ByVal) and user-defined data types (which you have to pass ByRef). If you want to pass a NULL value to an API function, declare the parameter as an Integer and pass a zero ByVal.

As an example, these two commonly-used API functions:

STATUS LNPUBLIC NSFDbOpen(char far *PathName, DBHANDLE far *rethDB);
STATUS LNPUBLIC NSFDbClose(DBHANDLE hDB);

are defined like this in LotusScript (on a Windows platform):

Declare Function NSFDbOpen Lib "nnotes.dll" (Byval PathName As String, _
rethDB As Long) As Integer
Declare Function NSFDbClose Lib "nnotes.dll" (Byval hDB As Long) As Integer

Note that the function's return value (STATUS, in this case) is at the beginning of the function declaration in C, and the LNPUBLIC part of the function gets thrown away (that's just the calling convention in C, and has nothing to do with your LotusScript calls). If a C function returns "void", you can treat it like a Sub.
来自nsftool

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值