Thread: _beginthread & c run-time library

  1. #1
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149

    _beginthread & c run-time library

    on msdn,it is said that:
    A thread in an executable that is linked to the static C run-time library (CRT) should use _beginthread and _endthread for thread management rather than CreateThread and ExitThread.
    what is "C run-time library"? what is the difference between it and "c++ standard library"?


    ps:why i cannot use _beginthread on CBuilderX ?
    when compile, it said _beginthread was undefined.

    i need your help,thanks

    blow me ... ...

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    First, have you included process.h?

    I am aware that Borland used to call some of their "lower" routines differently then MS, beginthredex() from MS was called beginthreadNT() by Borland. Simplest solution is probably to open the process.h header and search for the routines.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    what is "C run-time library"? what is the difference between it and "c++ standard library"?
    The C Run-Time library is defined by the C standard, the C++ Standard Library is defined by the C++ standard. The C++ standard also requires the C Run-Time library to be present.

    ps:why i cannot use _beginthread on CBuilderX ?
    Because _beginthread is a Microsoft-specific function and doesn't exist in Borland's compiler. Borland will have an equivalent function, and if not, you can use CreateThread directly.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    this is the error message i got:
    Error: Unresolved external '__beginthreadNT' referenced from C:\DOCUMENTS AND SETTINGS\OWNER\CBPROJECT\BOOKSMANAGEMENTSYSTEM\WIN DOWS\DEBUG_BUILD\BMSMAIN.OBJ
    i can find _beginthread(),_beginthreadex(),_beginthreadNT() in process.h
    but why i just cannot make it work?? i can't take it

    blow me ... ...

  5. #5
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    i got this on msdn:
    To use _beginthread or _beginthreadex, the application must link with one of the multithreaded C run-time libraries.
    will CBuilderX do it automatically ?
    or how can i link my program with one of the multithreaded C run-time libraries ?

    blow me ... ...

  6. #6
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    The error message you are seeing is a linker error not a compiler error. You are on the right track, you need to link with a multithreaded library. I know how to do that with Visual Studio, but I don't have Borland Builder any more.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  7. #7
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    LOL~~ it works !
    i linked a library - "cw32mti.lib".

    Thank you ~~~~~~~~
    so happy~~~~~

    blow me ... ...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Displaying Function Run Time
    By pf732k3 in forum C Programming
    Replies: 1
    Last Post: 03-21-2008, 12:36 PM
  2. Run time differences in Linux gcc versions
    By circuitbreaker in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2008, 11:09 PM
  3. undefined symbol error during linnk time of library
    By quickNitin in forum C++ Programming
    Replies: 7
    Last Post: 09-01-2006, 10:06 AM
  4. Visual C++ 2005 Express: Run Time Library
    By Rune Hunter in forum C++ Programming
    Replies: 4
    Last Post: 11-13-2005, 06:47 PM
  5. I apologize. Good bye.
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-03-2002, 06:51 PM