EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  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  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Calling Windows "managed code" from EPICS
From: Mark Rivers <[email protected]>
To: "'[email protected]'" <[email protected]>
Date: Fri, 6 Jan 2012 21:51:50 +0000
Folks,

I have recently come across two devices that I need to support where the vendor driver is in the form of "managed code". All of the vendor examples are written in C#.  I need to figure out how to call that code from an EPICS C++ driver.

One of the vendors is Princeton Instruments, and the product is called LightField.  It is the Windows 7 64-bit successor to their venerable WinView and WinSpec programs for CCD cameras.  WinView and WinSpec expose their functionality through the Microsoft COM interface.  My areaDetector Roper driver uses the COM interface from C++ to control detectors through WinView and WinSpec.  That is quite straightforward.

The other vendor is Measurement Computing who make USB data acquisition devices, among other things.  They provide a C callable library for all of their products, but only on Windows.  That is what I have used for my EPICS "measComp" package so far.  However, for their newer devices they are also providing an open-source OS-independent message based library written in C#.  This run on Windows of course, but also on Linux using the "mono" package:

http://www.mono-project.com/Main_Page

Right now I really need to write a driver for the Princeton Instruments LightField program on Windows.  According to this MSDN article:

http://msdn.microsoft.com/en-us/library/ms973872.aspx

it is possible to call managed code from C++.  It says:

" There are two main ways to expose a managed API to purely unmanaged callers: as a COM API or as a flat API. For C++ unmanaged clients that are willing to recompile their code with Visual Studio(r) .NET, there is a third option: directly accessing managed functionality through C++ interop. Suggestions for how and when to use these options are described in this section."

I am willing to recompile my code with Visual Studio .NET (I haven't even written it yet!), so the third option seems best. I should be able to directly call the managed code from my EPICS C++ driver.  Unfortunately this article does not go into any detail, and has no examples.

My question to the EPICS community: have any of you done this, and do have an example you would be willing to share?

Thanks,
Mark




Navigate by Date:
Prev: [CA] how to properly set up CAS and clients Pavel Masloff
Next: linux-gpib with asyn Wilkins, Stuart
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: [CA] how to properly set up CAS and clients Pavel Masloff
Next: linux-gpib with asyn Wilkins, Stuart
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024