diff --git a/Projects/MMLLib/libmml.lpi b/Projects/MMLLib/libmml.lpi index e884deb..112ebdc 100644 --- a/Projects/MMLLib/libmml.lpi +++ b/Projects/MMLLib/libmml.lpi @@ -42,12 +42,12 @@ - - + + - + @@ -60,11 +60,11 @@ - - - + + + - + @@ -72,9 +72,9 @@ - + - + @@ -104,10 +104,12 @@ - - - - + + + + + + @@ -154,9 +156,9 @@ - + - + @@ -164,9 +166,9 @@ - + - + @@ -182,9 +184,9 @@ - + - + @@ -200,9 +202,9 @@ - + - + @@ -318,119 +320,127 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + @@ -439,7 +449,7 @@ - + diff --git a/Projects/MMLLib/libmml.lpr b/Projects/MMLLib/libmml.lpr index 52e2314..f6b572c 100644 --- a/Projects/MMLLib/libmml.lpr +++ b/Projects/MMLLib/libmml.lpr @@ -3,10 +3,13 @@ library libmml; {$mode objfpc}{$H+} uses - cmem,Classes,interfaces,graphics,client; + cmem,Classes,interfaces,graphics,client,sysutils; {$R *.res} +type + PTPoint = ^TPoint; + var C: TClient; function test: pchar; @@ -24,12 +27,35 @@ begin C.IOManager.GetMousePos(result.x,result.y); end; +function returnpoints: PTPoint; +begin + result := AllocMem(sizeof(TPoint) * 2); + result[0].x := 5; + result[0].y := 10; + result[1].x := 20; + result[1].y := 30; +end; + +function printpoints(b: PTPoint; len: integer): boolean; +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); +begin + i := i + 1; +end; exports test, init, - getmousepos; + getmousepos, + returnpoints, + printpoints, + hoi; begin diff --git a/Projects/MMLLib/test.py b/Projects/MMLLib/test.py index 3aaeb15..56d6956 100755 --- a/Projects/MMLLib/test.py +++ b/Projects/MMLLib/test.py @@ -17,3 +17,23 @@ dll.getmousepos.restype = POINT b = dll.getmousepos() print b.x, b.y + +PPOINT = POINTER(POINT) + +dll.returnpoints.restype = PPOINT +c = dll.returnpoints() + +print c[0].x + +dll.printpoints.restype = c_int +dll.printpoints.argtypes = [PPOINT, c_int] + +d = dll.printpoints(c, 2) + +dll.hoi.restype = None +dll.hoi.argtypes = [POINTER(c_int)] + +e = c_int(5) +dll.hoi(byref(e)) + +print e