Linking ODBC applications on Windows

This section does not apply to 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 dbodbc12.dll.

 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\v7.0\lib
  2. To compile and link a simple ODBC application using the Microsoft compile and link tool, you can issue a single command at a command prompt. The following example compiles and links the application stored in odbc.c.

    cl odbc.c /Ic:\sa12\SDK\Include odbc32.lib
 See also