A small step for a man...

Started by rexxitall, July 05, 2021, 04:22:20 PM

Previous topic - Next topic

rexxitall

For those who are new to the VS compiler for Windows.
The VS C compiler defaults all the time out of the box to 32 bit.
To make things more interesting the needed batch file has on each compiler generation and installation a different location - and name. At least Microsoft say so, and they should know about :)
So you has first to get the current name of the batch file from the Microsoft documentation.
VS comes with FOUR compilers - and each ones has a own batch file to set up the right environment. In simple words you have all permutations of compiler and targets.
In fact i use a find tool to list me all 4 batch files and choose finally the 64bit batch to compile 64 bit on a 64 bit machine according to their folder names - as also stated by Microsoft ;)
A bit funny, somehow they seems not really to know where their thing lives :D
The batch itself closes immediatly after calling. So i wrote a batch witch opens a console first which then calls the setup batch from Microsoft. Just to keep this magic thing open.
Finally i add also a link for it to the desktop . (Problem finally solved !)
After this i started it, walked in the VS console window to the location of BC. I let BC64.exe create  C+ code with the -c flag and just run the ms compiler.
This is slightly different to the gcc compiler which does the same trick just with one setup batch but targets the architectures by compiler switches (which are also not that easy to find out).
The Microsoft resulting binary was around 25% less in size as the gcc result. (Without specify any fancy optimizer switches by booth). And it seems that Microsoft has implemented some switches to automatically enable parallel code execution. Which is interesting on modern machines.







MrBcx

#2
Hi Thomas,

Attached are versions of my batch files for use with Pelles C.

PC64.bat -- is for compiling 64-bit console apps
PW64.bat -- is for compiling 64-bit GUI apps
PD64.bat -- is for compiling 64-bit DLL files.

Obviously there's a lot more that goes into building an app than a batch
file but having a working batch file gets you closer to the finish line.

A good exercise for you would be to compile BCX.  The process is

BC       BC.bas   -- First translation of BCX with a working copy of BC.exe
PC64     BC.c     -- first compile
BC       BC.bas   -- Second translation of BCX using the new BC.exe that you just created
PC64     BC.c     -- second compile
BC       BC.bas  --  Third translation of BCX using the new BC.exe that you just created
PC64     BC.c    --  third and final compile

If everything ran correctly, you have now built a functioning 64-bit version of BCX.



rexxitall

Just to get your moods up - on the weekend i found some time to compile BC with some 64 bit compilers.

Pelles - no luck.

gcc works but how to say - somehow.
I am not a big fan of that outdated thing.

Microsoft was slightly tricky - you has to find the right batch to set up the 64bit compiler mode but then its nice.

LLVM ???? I confess that i am to stupid for this high end compiler. :) I guess they fiddle on some basic libs at the moment. So it can wait.

Anyhow, i am at the moment happy with the ms thing which has also a nice slightly fat IDE :D 18Gigs - if you install c and vb.net with its friends. For sure i will not miss anything
On the other hand - it also has a nice debugger ...

So next Weekend i could probably compile some 64bit dlls as a test run.
I was sure that i saw a sample for 64bit on "some" page but stupidly does not save them ...

Anyhow.
BTW i read today a thread about all the funny samples. A word about this.
Yes they are boring and awful to maintain. But what will a guy like me do at start ?
For sure, start the included batch and look if the exe files pop up.
Needles to say what you will think if all those samples fails.
Normally you would say time to go and find something working. :)
So thanks for the tremendous afford i can see at the moment to keep those samples as well as also the documentation in a consistent shape.
That is a lot of time you spend with those boring stuff.
So thank you very much that you do that !
There is another similar compiler out there where the guys fiddle on whatever and how to say
- maybe i better say nothing :D At least they do not do their house keeping.

A word about the naming conventions of those samples.
they would be slightly more handy if there would be a list whats inside ;)
Very often some kind of newbee knows roughtly what he is looking for - and then you has a 250 megatons folder with Sxyz.bas ;)

I laught a lot about Suzie User - in Germany we call them shortly D.A.U.
"Dümmster Anzunehmender User" means  "most stupid user you can assume"

I hope everyone will have a nice night and a nice day tomorrow
Thomas






There are those days you want urgend you Turbo Pascal 5.5 compiler back which was shipped on a few odd floppy discs :)