创建OLA对象 - CreateCOLAPlugInterFace
函数简介
创建OLA对象,用于后续接口的传参。
接口名称
CreateCOLAPlugInterFace
DLL调用
long CreateCOLAPlugInterFace();
参数说明
无参数。
示例
#include <stdio.h>
#include <windows.h>
typedef long (*CreateCOLAPlugInterFaceFunc)();
typedef int (*DestroyCOLAPlugInterFaceFunc)(long instance);
int main() {
HMODULE hModule = LoadLibrary("OLAPlugDll.dll");
if (!hModule) {
printf("Failed to load OLAPlugDll.dll\n");
return 1;
}
CreateCOLAPlugInterFaceFunc CreateCOLAPlugInterFace =
(CreateCOLAPlugInterFaceFunc)GetProcAddress(hModule, "CreateCOLAPlugInterFace");
long instance = CreateCOLAPlugInterFace();
if (instance != 0) {
printf("创建成功, instance=%ld\n", instance);
}
// 使用完成后释放
// DestroyCOLAPlugInterFace(instance);
FreeLibrary(hModule);
return 0;
}
返回值
长整型数:OLAPlug对象指针,用于后续接口的传参。返回 0 表示失败。
注意事项
- DLL与COM的调用模式不一样。
- 使用完成后需调用 DestroyCOLAPlugInterFace 释放对象。
