37,743
社区成员




import ctypes
from ctypes import *
def PyCoreCB( a ):
print('CallBack Core - {}'.format(a))
return 5
#-----------------------------------------------
def BeginTry():
ll = ctypes.cdll.LoadLibrary
lib = ll("./PyObjArm.so")
#lib = ll("./PyObj.so")
CMPCORE = CFUNCTYPE(c_int,c_int)
cCoreFunc = CMPCORE(PyCoreCB)
try:
lib.ZExeCB.restype = c_int
lib.ZExeCB( cCoreFunc)
except Exception as e:
print('Error: {}'.format( repr(e) ))
print('---------Print Test--------')
BeginTry()
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int (*cb_core)(int a);
int ZExeCB( cb_core df )
{
if(df!=NULL)
{
printf("%s","Exec Main CB2 \r\n");
df(2);
}
return 5;
}