代码拉取完成,页面将自动刷新
同步操作将从 kentzhang/python-sdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import ctypes
import os
import platform
from ctypes import *
import time
FN_do_test = {}
FN_do_test["name"] = "do_test"
FN_do_test["argtypes"] = [ctypes.c_void_p]
FN_do_test["restype"] = []
read_lib_name = "D:\\code\\kent\\gitee\\python-sdk\\libtestcallback.dll"
nativelib = PyDLL(read_lib_name,ctypes.RTLD_GLOBAL)
print("native lib: ",nativelib)
nativelib.dotest.argtypes = [ctypes.c_void_p]
nativelib.dotest.restypes = []
platsys = platform.platform()
if platsys.lower().startswith("win"):
libc = cdll.msvcrt
##linux
if "linux" in platsys.lower():
cdll.LoadLibrary("libc.so.6")
def fn_callback(buffer,buffersize):
print("buffer:{},size:{}".format(buffer,buffersize))
#strbuffer = ctypes.string_at(buffer)
strbuffer :ctypes.c_char*10 = b''
strbuffer.from_buffer(buffer,0)
print("aaa",strbuffer)
libc.strncpy(buffer,b"abcdefg\0",5)
print("now buffer is ",ctypes.string_at(buffer))
l = libc.strlen(buffer)
return l
CFN_CALLBACK = CFUNCTYPE(ctypes.c_int,POINTER(ctypes.c_char_p),ctypes.c_int)
cb = CFN_CALLBACK(fn_callback)
print("cb:",cb)
nativelib.dotest(cb)
#while 1:
time.sleep(3)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。