![]() |
|
This section describes how to compile DataBlade module code.
BladeSmith generates makefiles for UNIX and Visual C++ project files for Windows NT. When you compile the generated C source code, you produce a shared object file or dynamic link library, called project.bld, in the source code directory src\OS-platform, where OS-platform is the name of the operating system and platform on which you are compiling. For example, src\WinNT-i386 holds the shared object file compiled on a Windows NT computer.
Important: When you generate code in BladeSmith, set the Format property of the DataBlade folder to the correct file format for your operating system (UNIX or DOS). The default is DOS. See Generating Source Files for more information.
Compiling with Tracing Support
By default, DataBlade modules are compiled without tracing support.
To compile with tracing, you must have generated source code in BladeSmith with tracing. BladeSmith adds the DBDK_TRACE macros and the TraceSet_project procedure to your code if the Tracing property of the Source folder is set to True in BladeSmith's Generate DataBlade dialog box. See Generating Source Files for more information.
After you compile with tracing, you must enable tracing for the DataBlade module after you register it in a database. See Enabling Tracing in a DataBlade Module for instructions. You must also enable tracing in the database session. See Enabling Tracing in a Database Session for instructions.
On UNIX platforms, you use the generic ProjectU.mak makefile. This makefile includes platform-specific makefiles as files named makeinc.platform. To specify the UNIX platform, set the TARGET environment variable to the path and filename of the include file for your platform. Platform-specific files are located in the directory $INFORMIXDIR/incl/dbdk.
The makefile requires the INFORMIXDIR environment variable to be set to the Informix database server installation directory. The BINDIR variable in the makefile determines where the shared object file or dynamic link library is written.
BladeSmith creates server, all, and clean targets in the makefile. The server target builds the shared object file. The clean target deletes the shared object file or dynamic link library. The default all target is equivalent to the server target.
Important: Generate code in BladeSmith with the Format property set to UNIX. If you generate code for a UNIX DataBlade module with the DOS file format, you must convert the files to UNIX format before compiling.
To compile and link your DataBlade module shared object file
When you link on UNIX, the system displays a list of unresolved symbols. This list can contain these types of unresolved symbols:
To debug your DataBlade module while it executes in a database server process, you must build the shared object file with debugging symbols. You can either modify the makefile and add the required compiler flags to the CFLAGS variable, or set the COPTS variable on the make command line.
On Solaris, the following commands build shared object files with debugging symbols from the C shell:
On Windows NT, you use the project.dsw file generated by BladeSmith to build your DataBlade module with Visual C++ 6.0.
The compiled DataBlade module links to sapi.lib. This library resolves the mi_ and ifx_ symbols that the database server uses internally.
Visual C++ creates both a WinNT-i386 and a Debug directory under the src\c directory to hold the release version and the debug version, respectively, of the dynamic link library.
Important: Do not link the client DataBlade API library in %INFORMIXDIR%\lib\dmi into the DataBlade module; that library resolves client services instead of database server services.
Visual C++ also performs the following tasks on the computer on which the Informix database server resides:
See Chapter 10, Debugging and Testing DataBlade Modules on Windows NT, for instructions on using the DBDK Visual C++ Add-In to edit, compile, and debug a DataBlade module on Windows NT.