Compiling iODBC-compliant Cocoa applications follows the Programmer and System
guidelines defined by Apple, which can be found at:
http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/index.html
In Mac OS X, frameworks are the central development components of
a Cocoa-based application. They provide everything needed by a developer, from
include files to shared libraries with which you will link
your application. All frameworks support is well-managed in Apple's Project
Builder development environment. Project Builder provides a drag-and-drop
interface for selecting the frameworks with which to compile your application.
In addition to providing the required Cocoa frameworks for ODBC application
compilation, the iODBC SDK installation provides source code and a binary of
an ODBC test application (“odbctest”). Each framework installed
with the SDK provides the relevant set of include files and libraries.
The frameworks are installed in the following directories:
/Library/Frameworks/iODBC.framework
/Library/Frameworks/iODBCinst.framework
/Library/Frameworks/iODBCadm.framework
• The iODBC.framework is the core of the ODBC driver manager.
Its job is to align the application’s ODBC calls to the appropriate ODBC
driver.
• The iODBCinst.framework is the ODBC configuration manager.
It provides access to and manages the ODBC DSNs (Data Source Names).
• The iODBCadm.framework is the GUI manager. It provides graphical
control over all ODBC functionality.
The first prerequisite for compiling Cocoa-based applications is a frameworks-compliant
compiler and linker. The iODBC SDK installation provides a Project Builder
project file, which you can use to easily manage ODBC-compliant source along
with the required iODBC frameworks. Once compiled, your application can be shipped
with iODBC frameworks (under the GPL license).
Alternatively, you may compile Cocoa applications via the command-line linker
shipped with Project Builder. During the compilation phase,
the "–F" option specifies the path to the frameworks which your
application references. The correct syntax is "–Fdir",
where dir is the path you want to add, with no more than one path per
–F option. For iODBC, you simply add the following two directories:
/Library/Frameworks
/System/Library/Frameworks
A complete cc compilation command line would look like this:
cc –c "–F/Library/Frameworks"
"–F/System/Library/Frameworks" mysources.c
During the linkage phase, you use the same option as above, as well
as specifying all the frameworks with which you are linking, preceded by the
option –framework.
A complete cc linkage command line would look like:
cc –o "myapplication"
"–F/Library/Frameworks" "–F/System/Library/Frameworks"
\ -framework "iODBC" –framework "iODBCinst" –framework
"iODBCadm"
The above line would create a Cocoa-based (OS X only) application called "myapplication".
For more information on the system architecture of Cocoa and compiling with
frameworks, visit the following link: http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/Frameworks/