Technical Document #35


Technical Document #35

Doc ID: 35
Product: WinDriver
Version:  --

When trying to build my WinDriver application from MSDEV I get the following error:
int_io.obj : error LNK2001: unresolved external symbol __beginthreadex
How can I resolve this?

You should enable multi-threading from your project, by adding the relevant flag to the project settings.

The Microsoft flag, when compiling with MDSEV (Visual C++) is -MT. Therefore, be sure to add: /MT to the Project Settings. [Add this option in: 'Project' --> 'Settings...', under the 'C/C++' tab, 'Category: General', in the 'Project Options' box].

For other compilers, verify that the compiler-specific multi-threading flag is used. For example, the Borland C++ Builder flag is -tWM.

NOTE that the -MT and -tWM flags are already part of the WinDriver samples and generated DriverWizard projects for MSDEV and Borland C++ Builder (respectively). [For MSDEV 4.0 this is true beginning with v6.02 of WinDriver.]

In addition, beginning with v6.00 of WinDriver, in order to use WinDriver's thread functions (ThreadStart() and ThreadStop() - implemented in WinDriver/src/utils.c) from a C/C++ application, you should verify that your project includes a _MT precompiler definition. This definition is also an integrated part of the WinDriver samples and generated code.
For MSDEV 5-6 this definition is part of the samples/generated code beginning with v6.00 of WinDriver and for MSDEV 4 beginning with v6.02
For Borland C++ Builder (4-6) this definition is part of the samples/generated code beginning with version 6.03 of WinDriver.
When creating your own project or when using an earlier WinDriver version, you can add this definition to the project yourself:

In MSDEV, do either of the following:
  • Open the project in the MSDEV IDE, select: Project --> Settings … --> C/C++, and add _MT in the Preprocessor Definitions text box, under either the Preprocessor or General Category.
  • Modify the project (*.dsp) file or makefile (in MSDEV 4.0) directly by adding /D "_MT" under the # ADD CPP section.

In Borland C++ Builder do either of the following:
  • Add the _MT precompiler definition from within the Borland C++ Builder IDE:
    Project --> Options … --> Directories/Conditionals --> Conditionals --> Conditional Defines
  • Modify your project (*.bpr) file directly and set the "USDERDEFINES" section to the following:
    <USERDEFINES value="_MT"/>     [For BCB v5.00 - 6.00].
    Or:
    USERDEFINES = _MT                             [For BCB v4.0]


Back to Top
  |  Corporate Index  |