Skip to content

创建OLA对象 - CreateCOLAPlugInterFace

函数简介

创建OLA对象,用于后续接口的传参。

接口名称

CreateCOLAPlugInterFace

DLL调用

long CreateCOLAPlugInterFace();

参数说明

无参数。

示例

cpp
#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;
}
csharp
#include <stdio.h>
#include <windows.h>

typedef long (*CreateCOLAPlugInterFaceFunc)();
typedef int (*DestroyCOLAPlugInterFaceFunc)(long instance);

int main() {
    HMODULE hModule = OLAServer.LoadLibrary("OLAPlugDll.dll");
    if (!hModule) {
        Console.WriteLine("Failed to load OLAPlugDll.dll\n");
        return 1;
    }

    CreateCOLAPlugInterFaceFunc CreateCOLAPlugInterFace =
        (CreateCOLAPlugInterFaceFunc)OLAServer.GetProcAddress(hModule, "CreateCOLAPlugInterFace");

    if (instance != 0) {
        Console.WriteLine($"创建成功, instance=%ld\n", instance);
    }

    // 使用完成后释放
    // DestroyCOLAPlugInterFace(instance);
    OLAServer.FreeLibrary(hModule);
    return 0;
}
python
#include <stdio.h>
#include <windows.h>
typedef long (*CreateCOLAPlugInterFaceFunc)()
typedef int (*DestroyCOLAPlugInterFaceFunc)(long instance)
int main() {
HMODULE hModule = OLAServer.LoadLibrary("OLAPlugDll.dll")
if !hModule:
  print("Failed to load OLAPlugDll.dll\n")
  return 1
CreateCOLAPlugInterFaceFunc CreateCOLAPlugInterFace =
(CreateCOLAPlugInterFaceFunc)OLAServer.GetProcAddress(hModule, "CreateCOLAPlugInterFace")
if instance != 0:
  print("操作完成")
# 使用完成后释放
# DestroyCOLAPlugInterFace(instance)
OLAServer.FreeLibrary(hModule)
return 0

返回值

长整型数:OLAPlug对象指针,用于后续接口的传参。返回 0 表示失败。

注意事项