Using Microsoft C++

From InterBase
Jump to: navigation, search

Go Up to Building Applications


Use the following options when compiling applications with Microsoft C++:

Option Action

c

Compile without linking (DLLs only).

Zi

Generate complete debugging information.

DWIN32

Defines “WIN32” to be the null string.

D_MT

Use a multi-thread, statically-linked library.

For example, these commands use the Microsoft compiler to build a DLL that uses InterBase:

cl -c -Zi -DWIN32 -D_MT -LD udf.c
lib -out:udf.lib -def:funclib.def -machine:i586 -subsystem:console
link -DLL -out:funclib.dll -DEBUG:full,mapped -DEBUGTYPE:CV
-machine:i586 -entry:_DllMainCRTStartup@12 -subsystem:console
-verbose udf.obj udf.exp gds32.lib ib_util_ms.lib crtdll.lib

This command builds an InterBase executable using the Microsoft compiler:

cl -Zi -DWIN32 -D_MT -MD udftest.c udf.lib gds32.lib
ib_util_ms.lib crtdll.lib
Note: See Working with UDFs in the Developer's Guide for more about compiling and linking user-defined libraries.

Using the Dynamic Runtime Library:

If you are

  • using a Microsoft Visual C++ 2.0 or Microsoft Visual C++ 4.0
  • compiling and linking separately, and
  • using the Dynamic Runtime Library (msvcrt20.dll or msvcrt40.dll)

you need to use the /MD compiler flag to compile with the run time library (RTL), as well as linking with the correct import library.

Advance To: