• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

PowerBASIC has been sold! (PowerBasic IS ALIVE !)

Started by Marc Giao, January 31, 2017, 10:29:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

Atthis time i am quite confident that there will be some sort of PB x64 Sort of Compiler, wether from PB or from Brian Alvarez.

Patrice Terrier

The best solution is to use C++ under the hood to create a 64-bit PB compiler.  8)

and the other solution is to learn how to program in C++ directly  ;D
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge


Brian Alvarez

Quote from: Patrice Terrier on February 24, 2018, 09:37:34 AM
The best solution is to use C++ under the hood to create a 64-bit PB compiler.  8)

and the other solution is to learn how to program in C++ directly  ;D

It's done. Check this out:

http://www.jose.it-berater.org/smfforum/index.php?topic=5242.0

Mike Lobanovsky

Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)


Brian Alvarez

#36
Hello Chris,

Right now i am working on the PHP features of the engine, since those are what i use the most.

I went ahead and added an option switch to use BSTRS or STRINGS on the C++ engine to make it easier for 32 bit apps on the C++ engine. It is working pretty good. I figured that since Official PowerBASIC compiler cannot create 64 bit DLL's, it is (for now) not worth it to make it compatible with BSTR's, since i dont know of a way to have a 64bit application to use 32bit dlls. However the bases are set and its just a matter of a simple option to switch from generating BSTR or STRING source code.

Basically everything works, but there are lots of stock functions to do. I am creating those, but there will be needed another set of functions for the BSTR versions.

However, as much as i want to, i dont know if i should share. As i was pointed out, there might be problems if i do, so... I dont know.

Maybe i will share a video of it working to show how easy it is to use. Basically all you need to do to chage the target (once the compier paths are set) is set the headers like this:

' Compile an exe with PBWIN (32Bit).
#COMPILER PBWIN
#COMPILE EXE


' Compile an exe with PBCC (32Bit).
#COMPILER PBCC
#COMPILE EXE


' Compile an exe with the configured C++ compiler (32 or 64 Bit depending on the compiler and its settings).
#COMPILER CPP
#COMPILE EXE


' Compile a CGI with PBWIN.
#COMPILER PBWIN
#COMPILE CGI


' Compile a LIB CPP.
#COMPILER CPP
#COMPILE LIB


' Compile a PHP script.
#COMPILER PLURIBASIC
#COMPILE PHP


Et cetera.

Its pretty fun to work with it. However since i still need to work on a regular bill-paying job, i don't have as much time to work on it as a would like. Since i want to see it shine, and i need to have a regular job, and can't focus much on it, I am considering selling a "share" of it to someone who can develop it along with me. This would free me to work more on it and speedup things by having some aid. The code is pretty modularized and easy to understand, very carefully made since the beggining, so, it will not be a problem to mantain it.

Believe it or not, It is currently being developed in Itself. it can generate code to compile itself as a 32bit compiler (using PowrBASIC) and also generates its own source code for C++. However, since some stock functions for C++ are missing (the ARRAY statements like ARRAY SORT, ARRAY SCAN etc...) it cannot yet compile itself in 64 bit mode. Once those are created, there is nothing else preventing it from compiling itself as a 64bit compiler that can compile 64bit applications.

The bones for DDT are set. Meaning it will be able to compile DDT source code with no issues as a 64Bit apps once the stock functions are created. Cant wait to have time to create those!!!

There. Thats an update. :)





Raymond Leech

Quote from: Brian Alvarez on March 15, 2018, 11:40:26 AMHowever, as much as i want to, i don't know if i should share. As i was pointed out, there might be problems if i do, so... I don't know.

Brian, This is going far back in my memory, so apologies if I don't have all the facts at my fingertips. If you're interested in researching the ins/outs, I think you might want to talk to Eros at ThinBasic.  I seem to remember discussions on someone's forum about what he could and couldn't do to produce a non-infringing product.  I think it was about simply wrapping PBs commands and exposing them w/o a PB license.  The one example that sticks in my head is you couldn't write a language that had xPrint commands that simply called the PB xPrint functions, you had to write your OWN xPrint layer.

Since you're emitting 64bit code, seems pretty unlikely you're 'thunking' down to the PB 32bit runtime library. Just my $0.02.

Brian Alvarez


Hello Raymond,

You are right. 32 Bit stock functions cannot be embedded into a true 64 bit application. That is exactly what i repeatedly repost as missing, those stock functions that are not supposed to be wrapped. :)

One needs to write their own.

I once talked with Bob Zale about this i think. He said (and i think he also posted this on the forums) one is not allowed to wrap them in a function, using another name and claim as own. Thats all. For example, one could even use other functions like MID$ and INSTR to create a custom TRIM function, but directly wrapping TRIM$,would not be allowed. Doing a custom trim, using TRIM$ as part of it, would be allowed, as long as it was not a direct wrap. for example, it is OK to do this:

FUNCTION MYCUSTOMTRIM(BYCAL Src AS STRING) AS STRING
     FUNCTION = TRIM$(Src, ANY "&s**!")
END FUNCTION


But its not OK to do this:

FUNCTION MYTRIM(Src as String, OPT UseAny as Long, OPT Chars as String) as string

IF ISFALSE VARPTR(Chars) THEN
   FUNCTION = TRIM$(Src)
ELSEIF UseAny then
   FUNCTION = TRIM$(Src, ANY Chars)
ELSE
   FUNCTION = TRIM$(Src, Chars)
END IF

END FUNCTION




Frederick J. Harris

You are using a C++ compiler to generate 64 bit exes Brian?  If so, which one?  Could MSVC be used?  I'm wondering because I link against my TCLib to produce really small x64 exes.  But I only use MSVC.  I have not used GCC for some time for various reasons.  I'm wondering if your work would integrate into mine.  One of the issues that is depressing to me is that if a 64 bit PowerBASIC compiler would come along, would it be able to produce tight exes like PowerBASIC's 32 bit native compiler?  Generally speaking, C++ compilers that make use of anything from the C++ Standard Library generate large code.  In my work I have avoided that, and have been able to use all the features of C++ without generating large code.  I'm just wondering about these things.  I can manage without PowerBASIC, but I miss it bad. 

Brian Alvarez

Hello Frederick,

Yes. I am compiling 64bit EXEs with a C++ compiler.  I have used various compilers, but i havent tested with MSVC.

The engine i use generates requires a compiler that supports C++ 11 or newer. If you send me a copy of MSVC or a download link that installs offline, i can try it (and make tweaks to make it work). I preferably would like to suggest a compiler that doesnt require the .Net framework to be installed.

When i switch from #COMPILER PBWIN to #COMPILER CPP, the resulting sizes are dramatically different. For PBWIN i get (from my tests 5 minutes ago) an exe of size 28kb, when i use the CPP one, i get an exe of 1.8MB. Not exactly light. Of course, first one is 32 bit and second is 64 bit... but stilll....

Which one do you suggest to generate small executables?

Also integrate with what work? i mean, what do you do?

Brian. :)

Patrice Terrier

#41
We have posted already several examples showing that C++ 64-bit could be also very small in size.

VS 2017 Community is free and you can just install the C++ compiler if you want, no need to install the .NET version, you can also use it to produce Android applications...

Here is an example of a standalone 30 Kb 64-bit application that is a transposition of the PowerBASIC address example.
http://www.jose.it-berater.org/smfforum/index.php?topic=5185.0
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Brian Alvarez

 I am lost in the options Patrice. Could you point me to the compiler only? Every time i want to download it it either wants me to download the whole thing or update the whole visual studio i have already installed.

Its funny that only the list of files that is downloaded while installing visual studio, is 67 MB.... that is like 120 times bigger than the compiler i am writing... and it is only the list of files to download!!!

Very bloated stuff! In the time it takes my computer to open Visual studio 2017, i could open AND close Pluribasic like 70 times... WHILE Visual studio opens (i mean, at  the same time that visual studio is using lots of resources)!

Thanks. :)

Patrice Terrier

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Brian Alvarez

 Ohhh that was it! I was googling for "download".  ;D

Jk.