初版
This commit is contained in:
18
include/dp2_sdk_c.h
Normal file
18
include/dp2_sdk_c.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user