IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
      
     Home      Products      Services & solutions      Support & downloads      My account     
E-mail Feedback Help

Building a DataBlade DLL with Microsoft DevStudio

Table of Contents

Introduction
Sample Project
Creating a DevStudio Project
Exporting a Makefile
Glossary

Jean T. Anderson
October 9, 2000

© 2001 International Business Machines Corporation. All rights reserved.

Introduction

The easiest way to build a DataBlade DLL for NT is to use the DataBlade Developers Kit (DBDK), which provides a direct hook to Microsoft DevStudio. However, you must use the DBDK-generated source code and directory structure.

Some DataBlade developers want to build a project that conforms to their company code style and directory structure. With that in mind, this technical note explains how to build a DataBlade module from scratch with Microsoft DevStudio and without DBDK.

If you do not use DBDK to generate source code, it is still important to use DBDK to generate SQL scripts so that the DataBlade module can be registered using BladeManager.

Contents

Sample Project

This simple project creates a user-defined routine (UDR) that outputs the message "Hello World!". It requires the two files listed below:

  • C source code file:

    hello.c
     #include <mi.h> mi_lvarchar * hello_world () {  	mi_lvarchar *retval=NULL;      retval = mi_string_to_lvarchar("Hello World!");  	return retval; } 

  • Definition module file, which makes the C symbols in a DLL available:

    hello.def
     DESCRIPTION 'DLL for hello UDR'  EXPORTS 	hello_world 	

Contents

Creating a DevStudio Project

These instructions were tested with Microsoft DevStudio version 6.0.

Create a new project

  • Select File->New

  • In the Projects tab:

    • Select the "Win32 Dynamic-link Library" option.

    • Enter a project name in the  Project name  field.

    • Enter the directory location of the source files in the  Location  field.

    • Click on  OK .

  • On the Win32 Dynamic-Link Library screen:

    • Choose "An empty DLL project" option.

    • Click on  Finish .

  • On the New Project Information screen, click  OK 

  • .

Add your files to the project

  • Select   Project->Add To Project->Files.

    • Set  Files of type  to "C++ Files (.c;.cpp;.cxx;.tli;.h;.tlh;.inl;.rc)".

    • Select hello.c to add it to the  File name  field.

    • Click on  OK .

  • Select   Project->Add To Project->Files again.

    • Set  Files of type  to "Definition Files (.def)".

    • Select hello.def to add it to the  File name  field.

    • Click on  OK .

This simple project does not have any header files. To add header files, you would set  Files of type  to "C++ Include Files".

You can verify which files got added by selecting Project->Settings. Click on the  +  sign to the left of hello, then click on the  +  sign to the left of Source Files.

Set build options

This step requires setting the link and include paths.

  • Select Project->Settings

  • Select the Link tab:

    • Set the  Category  field to "General".

    • Add these two libraries to the end of the  Object/library modules  field (notice that libraries are separated by a space):

          sapi.lib ifxintfc.lib

    • Set the  Category  field to "Input".

    • Add "%INFORMIXDIR%\lib" to the  Additional library path  field.

    • If you want to change the default DLL name, for example to give it a .bld extension, edit the DLL name in the  Project Options  field.

  • Select the C/C++ tab

    • Set the  Category  field to "General".

    • Add these settings to the end of the  Preprocessor definitions  field (notice that each setting is separated by a comma):

          ,MI_SERVBUILD,NT,GL_NT_STATIC,NT_MI_SAPI

    • Set the  Category  field to "Preprocessor".

    • Add the %INFORMIXIDIR%\incl\public and %INFORMIXIDIR%\incl\esqlc directories to the  Additional Include Directories  field.

  • Press  OK 

Build the DataBlade DLL

Choose Build->Rebuild ALL to build the DataBlade DLL.

The Build->Configurations setting determines where the resulting DLL gets output. If it is set to "Win32 Debug", the DLL gets output to the Debug subdirectory. If it is set to "Win32 Release", the DLL gets output to the Release subdirectory.

Contents

Exporting a Makefile

Choose Project->Export Makefile to generate a makefile that allows compiling at the DOS prompt. For example, if you export a makefile for this project called "hello.mak", you can compile it as follows:

 nmake -f hello.mak 

Contents

Glossary

Acronyms and vocabulary used by this tech note include:

DBDK
DataBlade Developers Kit
DLL
Dynamic Link Library
UDR
User-Defined Routine

Contents


IBM, DB2, Informix, and WebSphere are trademarks or registered trademarks of IBM Corporation in the United States, other countries, or both.

Windows and Windows NT are registered trademarks of Microsoft Corporation in the United States, other countries, or both.

Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Other company, product, and service names may be trademarks or service marks of others.

IBM copyright and trademark information

 

Rate this article

Please rate this article. Your input is important to us!
 
This article is... Strongly
Agree
Agree Neutral Disagree Strongly
Disagree
Useful
Technically accurate
Technically complete
Logically organized
 
Which word best describes your level of knowledge of the subject matter?  
Comments: (800 character maximum)

IBM reserves the right to remove any inappropriate comments without notice. Although we cannot publish all comments, be assured that we do read all of them.
 
If you would like a response to your comment, please enter your e-mail address:
E-mail: 

 

    About IBM Privacy Contact