Closed lkraider closed 10 years ago
hi @lkraider , thanks for the report. Can you create a gist with a minimal version of your code that triggers this segmentation fault?
I should state that I am testing on OSX 10.9.2 with the x86_64 library compiled with lldb.
The examples/plain-c/server
and client
from the snap7 source work fine.
Looking at the source, the S7Object in python-snap7 is 32bit, which is the problem. The code below works:
import ctypes
lib = ctypes.cdll.LoadLibrary('lib/libsnap7.so')
print(lib)
lib.Cli_Create.restype = ctypes.c_void_p
cli = lib.Cli_Create()
print(hex(cli))
lib.Cli_ConnectTo.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_int]
res = lib.Cli_ConnectTo(cli, '127.0.0.1', 0, 0)
print(res)
result:
<CDLL 'lib/libsnap7.so', handle 7f983b462ed0 at 10f360f50>
0x7f983b875000
0
interesting, we've developed python-snap7 on 64bit linux so i'm not sure why this is a problem for 64 osx.
ikraider, out of curiosity what kind of project are you using snap7 for?
It's in a new custom production line for printing codes in a thermal printer. We use a PLC to control several parts of the line, and I read and also write to it from a python app that I created that generates these codes.
You are AWESOME ;)
Not sure about the changes, just tried to run it and got a segfault:
trace: