informix
DataBlade Developers Kit User's Guide
Programming DataBlade Module Routines in C

Compiling DataBlade Module Code

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.

Compiling on UNIX

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

  1. Copy the generated src/c directory and all of its contents to your UNIX machine.
  2. To compile and link shared objects on a Sun Solaris 2.5 computer using the SPARC compiler, execute the following command at the C shell:
  3. The project.bld file is created in the src/solaris-sparc directory.

    Important: For compiling information specific to your operating system, see your machine notes.

Unresolved Symbols

When you link on UNIX, the system displays a list of unresolved symbols. This list can contain these types of unresolved symbols:

Compiling with Debug Support

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:

Compiling on Windows NT

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.

To compile and link a dynamic link library using Visual C++

  1. Open the project.dsw in Visual C++.
  2. Choose Build Set Active Configuration.
  3. Select a version of the project in the Set Active Project Configuration dialog box:
  4. Click OK.
  5. Choose Build Rebuild All to compile.

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:

  1. Creates a project.0 directory under the directory where your database server is installed (%INFORMIXDIR%\extend)
  2. Copies the project.bld file and the SQL scripts to that directory
  3. Marks the project.bld file as read-only

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.


DataBlade Developers Kit User's Guide, Version 4.0
Copyright © 1999, Informix Software, Inc. All rights reserved