Linking ODBC applications on Windows

This section does not apply to Windows Mobile.

For Windows Mobile information, see Linking ODBC applications on Windows Mobile.

When linking your application, you must link against the appropriate import library file to have access to the ODBC functions. The import library defines entry points for the ODBC driver manager odbc32.dll. The driver manager in turn loads the SQL Anywhere ODBC driver dbodbc11.dll.

To link an ODBC application (Windows)
  1. Add the directory containing the platform-specific import library to the list of library directories in your LIB environment variable.

    Typically, the import library is stored under the Lib directory structure of the Microsoft platform SDK:

    Operating system Import library
    Windows (32-bit) Lib\odbc32.lib
    Windows (64-bit) Lib\x64\odbc32.lib

    Here is an example for a command prompt.

    set LIB=%LIB%;C:\mssdk\v6.1\lib
  2. To compile and link a simple ODBC application using the Microsoft compile and link tool, you can issue a single command from the command prompt. The following example compiles and links the application stored in odbc.c.

    cl odbc.c /Ic:\sa11\SDK\Include odbc32.lib