Harbour MT Mode and ST Mode

 

How build st mode

remove if present all instances of HB_BUILD_ST from your settings.

Please also remove all HB_MT_VM macros you may have in C_USR

How Build in mt mode

Creating both libraries is default as long as you do not change it
by some personal settings f.e. HB_BUILD_ST=no or HB_MT_VM in C

Wich difference are need from a MT application to a non mt application?


If you do not want to create your own threads then there is no differnce
for you. Only MT HVM is slower then non MT one but the difference
depends
on used C compiler, platform and your code. Usually user code calls many
RTL/RDD functions and pure HVM speed is less important.
If you want to create your own threads then you will have to follow
some general MT programming rules which are language independent.
Then use Harbour synchronization mechanisms if they are necessary for
your algorithms (f.e. you want to share or exchange some variables
between threads) to make your code MT safe.

Compilation and linking

For MT mode HVM library should be compiled with HB_MT_VM macro.
   GNU make automatically creates hbvmmt library which should be
   linked with Harbour MT programs instead of hbvm

> I resolved __beginthreadex removing cw32.lib and adding cw32mt.lib
> Also in not mt program we must load  cw32mt.lib instead cw32.lib?

No though it may be good practice for 3-rd party code which may use
own threads and call CRTL functions.
Harbour calls _beginthreadex/_endthreadex only from hbvmmt or
from hbvm but only if you compiled harbour with default MT support
without ST mode, f.e. for BCC you set HB_BUILD_ST macro to sth different
then "yes" and recompiled Harbour.

make copy of bld.bat, change hbvm.lib to hbvmmt.lib and add cw32mt.lib
and -tWN in line which executes bcc32.

 

What six start up objs go with what four bcc32 5.5 libs.

 ; Now, for MT builds 'set HB_USER_LIBS=cw32mt.lib' should 
      be used. Where cw32mt.lib may also be cp32mt.lib, 
      cp32mti.lib, cw32mti.lib depending on other factors.
      Notice that even this would only work if Harbour was 
      built with 'set HB_BUILD_ST=no'.

>Windows plain?

c0w32.obj + import32.lib + cw32.lib

>Windows multi threaded?

c0w32.obj + import32.lib + cw32mt.lib

>Windows DLL plain?

c0d32.obj + import32.lib + cw32.lib

>Windows DLL multi threaded?

c0d32.obj + import32.lib + cw32mt.lib

>Console plain?

c0x32.obj + import32.lib + cw32.lib

>Console multi threaded?

c0x32.obj + import32.lib + cw32mt.lib


To summarize the startup OBJs:
 

c0d32.obj 

DLL startup module

 

c0d32w.obj

DLL startup module

Wide-char version

c0d32x.obj

DLL startup module

no exception handling

c0pkg32.obj

Package startup module

 

c0w32.obj

GUI EXE startup module

 

c0w32w.obj

GUI EXE startup module

Wide-char version

c0x32.obj

32-bit console-mode EXE startup module

 

c0x32w.obj

32-bit console-mode EXE startup module

Wide-char version

The d stands for dll, the w for windows GUI exe's, and the x is for
console
mode exe's.

The RTL libs are

cp32mt.lib       VCL-compliant C RTL multithreaded static library
cp3250mt.dll, cp32mti.lib    VCL-compliant import library for
multithreaded C RTL
cw32.lib          RTL single-threaded static library
cw3250.dll, cw32i.lib  Import library for RTL cw3250.dll
cw32mt.lib      RTL multi-threaded static library
cw3250mt.dll, cw32mti.lib     Import library for multithreaded RTL
cw3250mt.dll

The 'p' in 'cp' means pascal. No need for that one. The 'i's stand for
import library. mt stands for multi-threaded. For simplicity, you can
stic
to cw32.lib and cw32mt.lib for apps compiled with the free bc55

 

 

 

Massimo Belgrano <mailto:[EMAIL PROTECTED]> 

 

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to