主题
检查注册授权状态 - CheckReg
函数简介
检查当前 OLAPlug 实例是否已通过注册授权(本地验证通过)。用于在调用业务接口前确认授权状态,或在 Reg / Login 之后做二次确认。
接口名称
CheckRegDLL 调用
int CheckReg(long ola);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 生成。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// 先 Reg / Login 后再检查
int ok = ola.CheckReg();
if (ok == 1) {
// 已授权,可调用业务接口
}csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ok = ola.CheckReg();python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ok = ola.CheckReg()java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ok = ola.CheckReg();go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
ok := ola.CheckReg()rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let ok = ola.check_reg();cpp
var ola = com("OlaPlug.OlaSoft")
var ok = ola.CheckReg()vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ok = ola.CheckReg()text
.局部变量 ola, OLAPlug
.局部变量 ok, 整数型
ola.创建 ()
ok = ola.CheckReg()aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ok = ola.CheckReg();text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
自动 ok = ola.CheckReg()cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ok = ola.CheckReg();原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
int ok = CheckReg(instance);csharp
using System.Runtime.InteropServices;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int CheckReg(long ola);
long instance = CreateCOLAPlugInterFace();
int ok = CheckReg(instance);python
from ctypes import CDLL, c_int, c_int64
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.CheckReg.restype = c_int
instance = ola.CreateCOLAPlugInterFace()
ok = ola.CheckReg(instance)返回值
| 返回值 | 说明 |
|---|---|
1 | 已授权(注册/登录验证通过,可按开通模块调用业务接口)。 |
0 | 未授权或校验未通过。 |
注意事项
| 项目 | 说明 |
|---|---|
| 与 Reg 的关系 | Reg / Login 成功后,CheckReg 通常返回 1;未注册、卡密失效、权限不足时返回 0。 |
| 使用场景 | 适合在长时间运行脚本中周期性检查授权是否仍有效,避免业务接口静默失败。 |
| 不替代业务权限 | 返回 1 表示基础授权通过;具体模块(如 YOLO、OCR)仍需在 FeatureList 中开通。 |
