C代碼如下:
#include
typedef struct TestDLL_
{typedef struct TestDLL_
} testdll;
testdll test(testdll t)
{
t.a=t.a+t.a;
printf("%dn%sn",t.a,t.b);
; python程式碼如下:from ctypes import * #絕對路徑 dllpath='test.dll' dll=CDLL(dllpath) 25) b= c_char_p('Hello world,Hello Chengdu') #定義結構體class testdll(Structure): _fields_ ) _ ('b',c_char_p)]
#實例化並賦值t=testdll() t.a=a t.b=b ll
#測試
t=dll.test(t)
print t.a
print t.b
x=raw_input('any key to continue')