1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 <2017> 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 <2017> 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: Is there any support for EPICS for IronPython (or anyone working on it)? |
From: | <[email protected]> |
To: | <[email protected]>, <[email protected]> |
Cc: | [email protected], [email protected] |
Date: | Sat, 13 May 2017 18:40:50 +0000 |
Hi, I’ve had a brief look at this – there doesn’t seem to be an in_dll() method on Arrays in IronPython, but I was able to work around it using: c_short_p = ctypes.POINTER(ctypes.c_short) value_offset0 = ctypes.c_short.in_dll(libca,'dbr_value_offset') dbr.value_offset = ctypes.cast(ctypes.addressof(value_offset0), (39*ctypes.c_short)) IronPython also looks to be a little more fussy about having types specified in function calls – so in the PyEpics call to libca.ca_create_channel I had
to change pvn to ctypes.c_char_p(pvn) as otherwise only the first character of the PV name seemed to get passed into ca.dll I suspect there may be a few other places where similar changes might be needed too as it’s not quite working yet. I’ve
some time later next week when I could take a more detailed look with a debugger if that’s not too late for you. Regards,
From: [email protected] [mailto:[email protected]]
On Behalf Of Matt Newville Hi Steven, On Fri, May 12, 2017 at 1:44 PM, Hartman, Steven M. <[email protected]> wrote: In follow up to
http://www.aps.anl.gov/epics/tech-talk/2016/msg01425.php from last August . . . I think the answer to the question in the subject line is: no one is working on this. But that's not a deliberate lack of support, and it doesn't mean it can't be done. I think it's just that no one has needed to do this, yet. PyEpics needs to load the CA library (ca.dll) for all CA communication. It does this using the ctypes library, which is (mostly) cross-platform. My understanding is that it is available for IronPython, and the message implies it is
partially working. dbr.value_offset = (39*ctypes.c_short).in_dll(libca, 'dbr_value_offset') which is a ctypes Array trying to look inside the DLL (held in `libca`) for a particular value that's needed to unpack some of the CA data structures. The message looks like it's saying that ctypes Arrays don't
have an `in_dll` method. I don't know why *that* is. From the perspective of "could pyepics ever work in IronPython", I'd say this is a pretty encouraging report -- it definitely didn't fail loading ca.dll! If the error with `in_dll` is the only problem, the
solution is probably pretty easy. But, there might be other challenges with ctypes too, and it might take some work to get it to work fully. --Matt Newville |