DP_S/include/dp2_sdk_c.h

19 lines
534 B
C
Raw Normal View History

2024-04-24 10:25:44 +08:00
#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;
}