Portability

The Aptina (Micron) Imaging Device Library (midlib) can be used by most programming languages and compilers. To use the library with C/C++ you must include the midlib2.h file. For Borland Delphi Pascal, use the midlib2.pas file. A library (midlib2.lib) module is included which can be used with MSVC projects and a Borland C++ Builder library (midlib2_omf.lib) is also included for Builder projects.
For step-by-step instructions on how to create a Visual Studio or Visual C++ project which uses midlib2 please refer to the document Visual Studio Project Settings Guide.pdf.
The midlib2.dll file is included for dynamic linking of the library. It is important to make sure that the midlib2.dll file which is loaded, matches the version of the library that the application has been built with. You should place the midlib2.dll file in the same directory as your application to make sure the correct version is found. You can also statically link the midlib library to ensure there are no mismatches. The SensorDemo and DevWare applications are statically linked.
To use Link-time dynamic loading (default) do the following:
Include the library module (midlib2.lib or midlib2_omf.lib) as part of the link stage in your project.
Call the functions as described in section 3.1.
In order for the structures to be aligned properly make sure your application project uses 8-byte alignment. This option can usually be found in the compiler options section for your integrated development environment. Also make sure that enums are treated as integers.
NOTE: midlib2.h should compile in your application without generating errors or warning messages. You may receive an error message regarding the Windows handle (HWND) in your console application or DLL. (A console application uses the DOS command line for input, it does not have a window in the Graphical User Interface). The error will be similar to the following and followed by several other errors:
Error C2065: 'HWND' : undeclared identifier
If you receive this error message, please do the following:
You will not be able to use device removal/arrival notification in your application. Remove this from your application if you have enabled it (for information on device removal/arrival notification, see section 3.8 above).
In your project's properties/settings dialog box, remove the '_WINDOWS' entry from the C/C++, Preprocessor Definitions entry.
Recompile your application.