tests/python/python@py_ext/py_ext.xml
branch1.1 Korean release
changeset 1280 72a826dfcfbb
parent 977 c8e008b8cefe
parent 1279 0eb9f8af479f
child 1384 02fe382c4511
equal deleted inserted replaced
977:c8e008b8cefe 1280:72a826dfcfbb
     1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
       
     2 <Python xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="py_ext_xsd.xsd">
       
     3 <![CDATA[import time,sys,ctypes
       
     4 Python_to_C_Call = PLCBinary.Python_to_C_Call
       
     5 Python_to_C_Call.restype = ctypes.c_int
       
     6 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)]
       
     7 
       
     8 def MyPythonFunc(arg):
       
     9     i = ctypes.c_int()
       
    10     if(Python_to_C_Call(arg, i)):
       
    11         res = i.value
       
    12         print "toC:", arg, "from C:", res, "FBID:", FBID
       
    13     else:
       
    14         print "Failed Python_to_C_Call failed"
       
    15         res = None
       
    16     sys.stdout.flush()
       
    17     return res
       
    18 ]]>
       
    19 </Python>