Next: 2.4 Using MIDAS from Up: 2 Getting started Previous: 2.2 Compiling with MIDAS

# 2.3 Linking with MIDAS

If your program uses MIDAS Digital Audio System, you naturally need to link with the MIDAS libraries as well. This section describes how to do that on each platform supported.

All MIDAS Digital Audio System libraries are stored under the `lib/` subdirectory in the distribution. `lib/` contains a subdirectory for each supported platform, and those in turn contain directories for each supported compiler. The format of the compiler directory names is ``<compiler><build>'', where <compiler> is a two-letter abbreviation for the compiler name, and <build> the library build type -- retail or debug. Under most circumstances, you should use the retail versions of the libraries, as they contain better optimized code. Also, the debug libraries are not included in all releases.

For example, `lib/win32/vcretail/midas.lib` is the retail build of the Win32 Visual C/C++ static library.

## 2.3.1 Windows NT/95

Under the Win32 platform, applications can link with MIDAS Digital Audio System either statically or dynamically. Unless there is a specific need to link with MIDAS statically, dynamic linking is recommended. Delphi users need to use dynamic linking always.

When linking with MIDAS statically, simply link with the library file corresponding to your development platform. For Watcom C/C++, the library is `lib/win32/wcretail/midas.lib`, and for Visual C/C++ `lib/win32/vcretail/midas.lib`. Depending on your configuration, you may need to add the library directory to your ``library paths'' list. When MIDAS is linked into the application statically, the .exe is self-contained and no MIDAS `.dll` files are needed.

Dynamic linking is done by linking with the appropriate MIDAS import library instead of the static linking library. In addition, the MIDAS Dynamic Link Library (`midasXX.dll`) needs to be placed in a suitable directory -- either to the same directory with the program executable, or in some directory in the user's PATH. The import libraries are stored in the same directory with the static libraries, but the file name is `midasdll.lib`. For example, Visual C users should link with `lib/win32/vcretail/midasdll.lib`. The MIDAS Dynamic Link Libraries are stored in `lib/win32/retail` and `lib/win32/debug`.

Delphi users do not need a separate import library -- using the interface unit `midasdll.pas` adds the necessary references to the `.dll` automatically. Note that running the program under the Delphi IDE without the `.dll` available can cause strange error messages.

## MS-DOS

As MS-DOS doesn't support dynamic linking, only a static link library is provided for MS-DOS. You'll simply need to link with the library from the appropriate subdirectory -- usually `lib/dos/gcretail` for GCC (DJGPP) and `lib/dos/wcretail` for Watcom C. The executable is fully self-contained, and no additional files are needed. DJGPP users also need to link with the Allegro library, as MIDAS uses some of its functions for IRQ handling.

Note that some versions of the Watcom Linker are not case-sensitive by default, and you'll need to use case-sensitive linking with MIDAS. To do that, simply add `option caseexact` to your linker directives.

## 2.3.3 Linux

For Linux, only a static library is provided for the time being. To link your program with MIDAS Digital Audio System, add the proper library directory (usually `lib/linux/gcretail`) to your library directory list (gcc option `-L`), and link the library in using the GCC option `-lmidas`.

Next: 2.4 Using MIDAS from Up: 2 Getting started Previous: 2.2 Compiling with MIDAS