...
Depending on the target system, it's only needed to load the correct DLL of the CIFX driver. Both DLL versions are provided in the CIFX driver package.
Performance & PLC
...
functions
In principle, the PLC functions are intended for high-performance applications with high timing requirements. The use of .NET itself is less suitable for such requirements.
Windows is not real-time capable by default and does not offer the possibility of influencing the time behavior of a process sufficiently.
...
The use of .NET is not recommended for applications in this context. Accordingly, the PLC functions of the CIFX API are not supported in the C # framework.
Hilscher - C#
...
Packet
Hilscher provides a VisualStudio project that implements the P/Invoke frame.
...
Using an example project, the demo also shows the integration of the wrapper DLL into an application.
Info | ||
---|---|---|
| ||
With .NET or VisualStudio it is possible to use both C # .NET and VB.NET projects within a VisualStudio solution. To do this, a project of the corresponding type can simply be added: File → Add → New Project. |
...
"In .NET there is an integral data type, not widely known, that is specifically designated to hold 'pointer' information: IntPtr whose size is dependent on the platform (eg, 32-bit or 64-bit) it is running on. "
Code Block | ||
---|---|---|
| ||
public void SizeOfIntPtr() {Console.WriteLine( "SizeOf IntPtr is: {0}", IntPtr.Size );} |
...
In the new version, the pointers described above are used instead, in order to work for both 32-bit and 64-bit applications.
Code Block | ||
---|---|---|
| ||
[DllImport("cifx32dll.dll", EntryPoint = "xChannelOpen")] private static extern UInt32 _xChannelOpen( UInt32 hDriver, [MarshalAs(UnmanagedType.LPStr)] string szBoard, UInt32 ulChannel, [MarshalAs(UnmanagedType.U4)] ref UInt32 phChannel); |
Code Block | ||
---|---|---|
| ||
[DllImport("cifx32dll.dll",EntryPoint = "xChannelOpen")] private static extern Int32 _xChannelOpen ( IntPtr hDriver, [MarshalAs(UnmanagedType.LPStr)] string szBoard, UInt32 ulChannel, ref IntPtr phChannel); |