#pragma once
#include <dlfcn.h>

typedef struct lua_State lua_State;
typedef void (*dp2_game_script_t)(void(*ufptr)(lua_State* L, void*), void* udptr);

// 进入dp的锁, 触发回调, 同时获得lua指针
static int dp2_game_script(void(*ufptr)(lua_State* L, void*), void* udptr) {
    void* fn = dlsym(RTLD_DEFAULT, "__dp2_game_script");
    if (!fn) {
        return 1;
    }
    dp2_game_script_t func = (dp2_game_script_t)fn;
    printf("\n函数\n");
    func(ufptr, udptr);
    printf("\n调用成功\n");
    return 0;
}
