Next: 2.3 An example program Up: 2 Getting started Previous: 2.1 Compiling with MIDAS

# 2.2 Linking with MIDAS

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

## 2.2.1 Windows NT/95

Under the Win32 platform, applications can link with MIDAS 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 in the library file corresponding to your development platform. All MIDAS libraries are located in the `lib/` subdirectory of the distribution. Watcom C/C++ users need to link with the file `midasnt_watcom.lib`, and Visual C/C++ users with `midasnt_visualc.lib`. Depending on your configuration, you may need to add the `lib/` subdirectory into 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 library names correspond to the `.dll` name: `midasXX_visualc.lib` for Visual C/C++ and `midasXX_watcom.lib` for Watcom C/C++. (the XX stands for the MIDAS version number).

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 file `midasdos.lib` from the `lib/` subdirectory of the MIDAS distribution, and your program is ready to use MIDAS Sound System. The executable is fully self-contained, and no additional files are needed.

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.2.3 Linux

For Linux, both dynamic and static libraries are provided. To link your program with MIDAS, add the MIDAS library directory to your library directory list (gcc option `-L`), and link the library in using the GCC option `-lmidas`. Depending on whether you are building a statically or dynamically linked program, GCC will automatically select the correct library.

Next: 2.3 An example program Up: 2 Getting started Previous: 2.1 Compiling with MIDAS