Compiler with MSVC y HARBOUR

Compiler with MSVC y HARBOUR

Postby acuellar » Thu Apr 18, 2024 8:32 pm

Good dears

If you are still with BCC and xHarbour/Harbour
It's time to switch to the best, with MSVC and HARBOR It really is much faster

Download newly updated HARBOR for MSVC fromhttps://github.com/FiveTechSoft/harbour_and_xharbour_builds/blob/master/README.md
Download Visual Studio Community from https://visualstudio.microsoft.com/es/vs/community/ https://visualstudio.microsoft.com/es/vs/community/

With VisualStudioSetup.exe install Desarrollo para el escritorio con C++

After installing it, if you want to make it portable you can do it with this Script

CreaPortableMSVC.bat (Change the destination route and x86 to x64 as needed)
Code: Select all  Expand view  RUN

ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx86\x86" D:\Compiler\VS2022\Bin /MIR
ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\x86" D:\Compiler\VS2022\Lib *.LIB
ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" D:\Compiler\VS2022\Include *.h
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86" D:\Compiler\VS2022\Bin RC.EXE
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86" D:\Compiler\VS2022\Bin RCDLL.DLL
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x86" D:\Compiler\VS2022\Lib *.LIB
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x86" D:\Compiler\VS2022\Lib *.LIB
 


After creating your VS2022 portable you can uninstall Visual Studio and recover the 10GB that you used in the installation

To link to the UEstudio Editor use this Application
Code: Select all  Expand view  RUN


# --------- Harbour y FWH configuration --------
# --- general --------------------------------------
# $P  - project name
# $Pp - path to project directory
# $Pn - project name
# --- compile --------------------------------------
# $I  - input full name
# $Ip - input path
# $In - input name
# $Ie - input extension
# $O  - output file
# $Op - path to output file
# $On - output filename (without path)
# $Oe - output extension
# $R  - release/debug setting for compiler
# --- build ----------------------------------------
# $T  - target full name
# $Tp - target path
# $Tn - target name
# $O  - output file
# $Op - path to output file
# $On - output filename (without path)
# $Oe - output extension
# $R  - release/debug setting for linker

[Settings]
Target =
Category&01 = DEFAULT RUN CONFIGURATION
Working Directory =.
Command Line Arguments =

Category&02 = Harbour Options
Automatic Memvar Declaration = no|yes
Variables Are Assumed = no|yes
Generate Preprocessed Output = no|yes
Warning Level = 1|2|3|4|0
User Include Path =
User Defines =

Compiler Options =
Linker Options =

Excluded Files = Excludes

[SettingsInfo]
Target = Provides a space for you to specify an output file and location of the program that the linker creates.
Working Directory = Provides a space for you to specify the directory in which executing occurs. If you do not specify a directory, executing occurs in the directory where the executable is located.
Command Line Arguments = Provides a space for you to specify command-line arguments you want to pass to the program at startup.
Compiler Options = Provides a space for you to specify an additional compiler options.
User Defines = Shows the switches the tool will use to build. Use ';' as delimiter.
Linker Options = Provides a space for you to specify an additional linker options.
Excluded Files = This will exclude the file(s) included in this UE project group from the build.

[SettingsReps]
User Defines = @[;|-D%s]
Automatic Memvar Declaration = no=|yes=/a
Variables Are Assumed = no=|yes=/v
Generate Preprocessed Output = no=|yes=/p
User Include Path = ^^@[;|;%s]
User Include Path&1 = ^^@[;| /i%s]
Use Multi Thread Library = no|yes
Warning Level = @/w%s

[Variables]
FWH = D:\COMPILER\FWH
HPATH = D:\COMPILER\HarbourVS
VSPATH = D:\Compiler\VS2022

HPATHL = $(HPATH)\LIB
VSPATHL = $(VSPATH)\LIB

HOPT = /n /gc0 /q $(Compiler Options) /i$(HPATH)\INCLUDE $(User Include Path&1) $(User Defines) $(Automatic Memvar Declaration) $(Variables Are Assumed) $(Generate Preprocessed Output) $(Warning Level)

COPT = -TP -W3 -c -I$(HPATH)\INCLUDE
LOPT = /nologo /subsystem:windows /force:multiple /NODEFAULTLIB:libucrt /NODEFAULTLIB:msvcrt

LIBS1 = $(FWH)\LIB\FiveH32.lib $(FWH)\LIB\FiveHC32.lib
LIBS2 = $(HPATHL)\hbrtl.lib $(HPATHL)\hbvm.lib $(HPATHL)\gtgui.lib $(HPATHL)\hblang.lib $(HPATHL)\hbmacro.lib $(HPATHL)\hbrdd.lib $(HPATHL)\rddntx.lib $(HPATHL)\rddcdx.lib $(HPATHL)\rddfpt.lib $(HPATHL)\hbsix.lib $(HPATHL)\hbcommon.lib $(HPATHL)\hbpp.lib $(HPATHL)\xhb.lib $(HPATHL)\hbzlib.lib $(HPATHL)\hbcpage.lib $(HPATHL)\hbwin.lib $(HPATHL)\hbct.lib $(HPATHL)\hbcplr.lib $(HPATHL)\hbpcre.lib $(HPATHL)\hbziparc.lib $(HPATHL)\minizip.lib $(HPATHL)\hbmzip.lib $(HPATHL)\hbtip.lib $(HPATHL)\hbzebra.lib
LIBS3 = $(VSPATHL)\user32.lib $(VSPATHL)\gdi32.lib $(VSPATHL)\winspool.lib $(VSPATHL)\comctl32.lib $(VSPATHL)\comdlg32.lib $(VSPATHL)\advapi32.lib $(VSPATHL)\shell32.lib $(VSPATHL)\ole32.lib $(VSPATHL)\oleaut32.lib $(VSPATHL)\mpr.lib $(VSPATHL)\version.lib $(VSPATHL)\msimg32.lib $(VSPATHL)\oledlg.lib $(VSPATHL)\gdiplus.lib $(VSPATHL)\winmm.lib $(VSPATHL)\ws2_32.lib $(VSPATHL)\iphlpapi.lib $(VSPATHL)\ucrt.lib
LIBS = $(LIBS1) $(LIBS2) $(LIBS3)

[Environment]
PATH = $(HPATH)\BIN;$(VSPATH)\BIN;%PATH%
INCLUDE = $(FWH)\INCLUDE;$(HPATH)\INCLUDE;$(VSPATH)\INCLUDE
LIB = $(HPATHL);$(VSPATHL);$(FWH)\LIB
BuildMode = %UESMode%

[General]
TargetExt = .EXE
ReleaseOut = Release
DebugOut = Debug
UseFullPaths = 1
UseDosNames = 0
Excludes = $(Excluded Files)
GenerateEDGroup=$(External Dependencies)
.CPP = .C

[MakeCommands]
run = Execute Application
makef = Show Makefile

[Execute Application]
Title = Execute $T
Cmd0 = $(Command Line Arguments)
Depends = $T
ShowWindow = 1
DisplayConsole = 0

[Show Makefile]
Title=Show makefile
Cmd0=uestudio makefile
ShowWindow=1
DisplayConsole=0

[InsertFiles]

[FileGroups]
FGO = .obj;
FGR = .res;
FGL = .lib;
FGD = .def;

[GroupFormats]
FGO = %s
FGR = %s
FGL = %s

[Build]
Out = $T
Depends = $FGO $FGR
DebugFlag =
ReleaseFlag =
Cmd0 = $(VSPATH)\BIN\LINK $(LOPT) /OUT:$Pp\$T $FGO $FGR $(LIBS1) $(LIBS2) $(LIBS3)
Cmd1 = $Pp\$T

[.PRG]
Out = $In.c
DebugFlag = /b
ReleaseFlag = /l
Cmd0 = $(HPATH)\BIN\harbour $I $(HOPT) $R /o$O

IncFiles = 1
CaseSensitive = 0
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.

[.C]
Out = $In.obj
Cmd0 = $(VSPATH)\BIN\cl.exe $(COPT) $I

[.RC]
Out = $In.res
Cmd0 = $(VSPATH)\bin\rc -r -fo$O $I

IncFiles = 1
CaseSensitive = 0
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.
 


To link to Hbmk use this Script GoHbmk.bat
Code: Select all  Expand view  RUN
Set path=D:\Compiler\VS2022\BIN
D:\Compiler\HarbourVS\bin\hbmk2 prg\proyecto.hbp -comp=msvc -run
 


The proyecto.hbp
Code: Select all  Expand view  RUN
-gui
-w0
-ID:\Compiler\FWH\include;D:\Compiler\VS2022\include

programa1.PRG
programa1.RES
-LD:\Compiler\FWH\LIB;D:\Compiler\VS2022\lib
-lfiveh32
-lfivehc32
-lgdiplus
-lOleDlg
-lversion
-lucrt

xhb.hbc
hbct.hbc
hbwin.hbc
hbmzip.hbc
hbziparc.hbc

-ldflag=/NODEFAULTLIB:libucrt
-ldflag=/NODEFAULTLIB:msvcrt
programa.RC
 


With MSVC you can include the mysqlclient.lib library from FWH which is for MySql/MariaDB which makes your system 100% portable and does not need libmariadb.dll and libmysql.dll (the executable grows a little)

I hope it helps you and gives you the opportunity to use these wonderful tools with which you will notice the big difference in the performance of your systems.
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1644
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Compiler with MSVC y HARBOUR

Postby Otto » Fri Apr 19, 2024 6:26 am

Dear Adhemar,
Thank you very much. You are a master of portable installations.

Just yesterday, I was dealing with your mod harbour installation.
I am always weighing whether it makes sense to use WebView2, or whether it might be simpler to use a localhost server everywhere.
That's why I am creating a distribution for our users.

Perhaps you would be so kind as to explain your mod harbour installation as well.

I have seen that the binaries can be downloaded from https://www.apachefriends.org. If I now copy the new binaries into the bin folder and delete the entire folder beforehand, then mod harbour no longer works.
I have seen that I need the following files additionally:
c:\Apache24\bin\libssl-1_1-x64.dll
c:\Apache24\bin\libcrypto-1_1-x64.dll
c:\Apache24\bin\libcurl-x64.dll

Perhaps we could then create a Fivewin test program that checks all files and settings.
Possibly also implements necessary security settings for us mod harbour developers.


With best thanks in advance,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6333
Joined: Fri Oct 07, 2005 7:07 pm

Re: Compiler with MSVC y HARBOUR

Postby hua » Fri Apr 19, 2024 6:38 am

Thank you for such a detailed instructions.
Since I'm not using UEStudio, I also copied out "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat"

acuellar wrote:Good dears

If you are still with BCC and xHarbour/Harbour
It's time to switch to the best, with MSVC and HARBOR It really is much faster

Download newly updated HARBOR for MSVC fromhttps://github.com/FiveTechSoft/harbour_and_xharbour_builds/blob/master/README.md
Download Visual Studio Community from https://visualstudio.microsoft.com/es/vs/community/ https://visualstudio.microsoft.com/es/vs/community/

With VisualStudioSetup.exe install Desarrollo para el escritorio con C++

After installing it, if you want to make it portable you can do it with this Script

CreaPortableMSVC.bat (Change the destination route and x86 to x64 as needed)
Code: Select all  Expand view  RUN

ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx86\x86" D:\Compiler\VS2022\Bin /MIR
ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\x86" D:\Compiler\VS2022\Lib *.LIB
ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" D:\Compiler\VS2022\Include *.h
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86" D:\Compiler\VS2022\Bin RC.EXE
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86" D:\Compiler\VS2022\Bin RCDLL.DLL
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x86" D:\Compiler\VS2022\Lib *.LIB
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x86" D:\Compiler\VS2022\Lib *.LIB
 


After creating your VS2022 portable you can uninstall Visual Studio and recover the 10GB that you used in the installation
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Compiler with MSVC y HARBOUR

Postby Otto » Sat Apr 20, 2024 6:35 am

Hello friends,
I am now comparing Adhemar's installation for mod harbour portable with the version downloaded from apachefriends.org:

There are these additional files in Adhemar's zip - here with ChatGPT what they are for.
Best regards,
Otto

The files libssl-1_1-x64.dll, libcrypto-1_1-x64.dll, and libcurl-x64.dll are essential dynamic link library (DLL) files commonly used in Windows environments to provide SSL/TLS, cryptographic functions, and URL transfer capabilities respectively. Here's a breakdown of each:

1. libssl-1_1-x64.dll
Purpose: This library is part of OpenSSL and provides the SSL/TLS protocol support necessary for secure communications over networks. It's used to encrypt data transmitted over network connections, helping secure web communications for services like HTTPS.
Where to Get: This DLL is typically part of the OpenSSL distribution. You can download it from the OpenSSL official website or from other trusted sources that distribute OpenSSL binaries for Windows.
2. libcrypto-1_1-x64.dll
Purpose: Also a part of OpenSSL, this library handles a wide range of cryptographic operations, such as symmetric encryption, asymmetric encryption, and hash functions. It's essential for generating secure keys, encrypting data, and ensuring the integrity and authenticity of data.
Where to Get: Like libssl-1_1-x64.dll, libcrypto-1_1-x64.dll comes with the OpenSSL package. It is usually distributed alongside libssl as they work together to provide security features.
3. libcurl-x64.dll
Purpose: libcurl is a free, client-side URL transfer library supporting a lot of different protocols (HTTP, HTTPS, FTP, etc.). It's commonly used in applications that need to communicate with other servers over the Internet or other networks.
Where to Get: This DLL can be obtained from the official cURL website or through distributions that package cURL for Windows environments.
Do You Need These for a Secure Apache Server?
Apache and OpenSSL: For Apache to support HTTPS, it requires SSL/TLS libraries. On Windows, Apache often leverages OpenSSL through libssl and libcrypto to enable HTTPS functionality. If you are setting up Apache to serve secure websites, these libraries are essential.
libcurl: This library is not typically required for running Apache itself but may be necessary if you are using Apache modules or other components that depend on cURL for external communications.
Installation and Configuration
To use these DLLs with Apache on Windows:

Download and Install: First, download the necessary binaries from their official sources or trusted binary distributions.
Configuration: Place the DLL files in an appropriate directory, commonly within the Apache installation directory or a system path where Apache can access them. You might need to configure the httpd.conf or other relevant Apache configuration files to specify the paths to these libraries if not automatically detected.
Test: After installation and configuration, restart Apache and check the error logs to ensure there are no issues loading these libraries.
By ensuring these libraries are correctly installed and configured, you enhance the capabilities and security of your Apache server, particularly in handling encrypted communications and secure data transfer.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6333
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 38 guests