Merge branch 'master' of ssh://villavu.com:54367/simba

This commit is contained in:
Raymond 2010-03-27 13:12:43 +01:00
commit a0ba655c1d
2 changed files with 16 additions and 10 deletions

View File

@ -23,12 +23,12 @@ begin
C:=TCLient.Create('');
end;
function getmousepos: tpoint;
function getmousepos: tpoint; cdecl;
begin
C.IOManager.GetMousePos(result.x,result.y);
end;
function returnpoints: PTPoint;
function returnpoints: PTPoint; cdecl;
begin
result := AllocMem(sizeof(TPoint) * 2);
@ -38,19 +38,19 @@ begin
result[1].y := 30;
end;
function printpoints(b: PTPoint; len: integer): boolean;
function printpoints(b: PTPoint; len: integer): boolean; cdecl;
var i:integer;
begin
for i := 0 to len - 1 do
writeln('X, Y: (' + inttostr(b[i].x) + ', ' + inttostr(b[i].y) + ')');
end;
procedure hoi(var i: integer);
procedure hoi(var i: integer); cdecl;
begin
i := i + 1;
end;
function givedtm:PPDTM;
function givedtm:PPDTM; cdecl;
var
dtm: PPDTM;
begin

View File

@ -1,7 +1,12 @@
#!/usr/bin/env python
from ctypes import *
import platform
dll = CDLL('./libmml.so')
if platform.system() == 'Windows':
dll = CDLL('./libmml.dll')
print 'On Windows'
else:
dll = CDLL('./libmml.so')
dll.test.restype = c_char_p
a = dll.test()
print a
@ -10,10 +15,11 @@ dll.init.restype = None
dll.init()
class POINT(Structure):
_fields_ = [('x', c_int),
('y', c_int)]
_fields_ = [('x', c_int),
('y', c_int)]
dll.getmousepos.restype = POINT
dll.getmousepos.argtypes = None
b = dll.getmousepos()
print b.x, b.y
@ -30,8 +36,8 @@ dll.printpoints.argtypes = [PPOINT, c_int]
d = dll.printpoints(c, 2)
dll.hoi.restype = None
dll.hoi.argtypes = [POINTER(c_int)]
#dll.hoi.restype = None
#dll.hoi.argtypes = [POINTER(c_int)]
e = c_int(5)
dll.hoi(byref(e))