Libraries are external modules containing procedures, classes and other programming elements. ATEasy can use two kinds of libraries:
● Dynamic Link Libraries (DLL) – which
are files, typically with .DLL file extensions, that contain procedures.
Most PC-based instrument drivers are now shipped as a DLL library. Microsoft
Windows is also built from a set of DLLs that provides access to its services.
DLLs do not contain type definition of the procedures and their parameters
they hold. ATEasy
thus makes use of C/C++ header file (.h) that is usually supplied with
the DLL and create the procedures, types and constants definitions by
reading them from the header file and creating ATEasy
equivalents.
ATEasy version 7.0 supports creating a DLL by setting the project
target type to DLL. With the Build Command, an ATEasy
DLL will be created, and it can in turn be used by other ATEasy or other programming languages
projects. For more information, refer to ATEasy
DLL.
● Type Libraries – which contain classes, procedures, and other programming elements and are based on Microsoft component technology (COM). Type libraries allow you to make use of classes exposed by external libraries or application. Examples of type libraries are: ActiveX controls or MS-Excel. Unlike DLL where you are required to define the programming elements included in it, a type library contains a complete definition of the programming elements exported by the library.
● .NET Assemblies – which contain classes, procedures, and other programming elements and are based on Microsoft .NET technology. Unlike DLL where you are required to define the programming elements included in it, a .NET assembly contains a complete definition of the programming elements exported by the library.
In this chapter, you will learn how to use an instrument driver DLL for the GX6138, a 3U PXI high current relay board. The driver uses a DLL GXSW.DLL provided with ATEasy. More robust examples for using DLLs can be found in the examples provided with ATEasy in the Language.prj and DLL.prj (along with the DLL sources written in C) files located in your \Examples sub-folder.
You will also learn how to use a type library. We will use the MS-EXCEL type library to use Excel. A more complete example for this can be found in Excel.prg located in your \Example sub-folder.
Also provided in your examples folder is a .NET assembly including sources and ATEasy application DotNet.prj and C# programming language .NET sources for the assembly used.
Libraries are added to any module under the Libraries
submodule. Each module can have its own libraries, which, if made public,
can be used by other modules. Once a library is added to a module, you
can call procedures and use classes residing in the library. In addition,
if a type library contains an ActiveX control then the control will be
added to the Controls toolbar. It can be used by dragging it onto an ATEasy form in a similar way to the way
you use ATEasy built-in controls.