C# Interface / CLI¶
The EnsensoSDK provides two Wrapper-DLLs NxLibCLI32.dll and NxLibCLI64.dll. These DLLs provide a .NET compatible interface to use NxLib from within various .NET languages. The interface is almost identical to the C++ version and defines the same basic access functions and constants as well as the NxLibItem, NxLibCommand and NxLibException classes.
Using NxLib CLI from Visual Studio
By adding a reference to NxLibCLI32.dll or NxLibCLI64.dll to your C# project you can use NxLib’s object oriented interface as to access the tree items and execute commands. You can also have a look at the C# example programs to get started more quickly.
Usage Differences to the C/C++ API
The .NET interface is designed to provide an identical set of functions to the C/C++ world where ever possible, but there are a few minor design changes made for the CLI interface:
Function names are UpperCamelCase to match the C# naming conventions
Basic access functions and constants are made available within a global, static object named NxLib. Thus all predefined constants for node names, JSON item type, etc. need to be prefixed with “NxLib.”. An additional prefix “NxLib” on general constants has been dropped: Examples:
NxLib.cmdCapture instead of cmdCapture
NxLib.valStereo instead of valStereo
NxLib.ItemTypeString instead of NxLibItemTypeString
The exception throwing variants of Initialize and Finalize have been dropped to prevent a collision with the Finalize function of C# objects. You can call NxLib.CheckReturnCode with the return code from NxLib.Initialize or NxLib.Finalize to manually throw an NxLibException if the return code was not NxLib.OperationSuccessful.
All other functionality has remained the same as in C/C++. For information on the usage of the NxLibItem , NxLibCommand and NxLibException classes please also refer to the documentation of these classes in the object oriented C++ API.
The CLI interface DLLs can be found in your installation directory under %ENSENSO_INSTALL%/development/cli.
The CLI interface was primarily designed for C#, but it can be used from VisualBasic.NET, J# or from within any other CLI language. See also Wikipedia’s article List of CLI Languages.