need some tips to convert from Powerbasic to Freebasic

New to FreeBASIC? Post your questions here.
chrisc
Posts: 10
Joined: Dec 04, 2016 18:59

need some tips to convert from Powerbasic to Freebasic

Post by chrisc »

Hello all

i would like to have some tips to convert from Powerbasic to Freebasic

if you have the experience in this issue, please show me some codes and tips

currently i'm using Paul's WinFBE and Jose's WinFBX

appreciate all help on this, thanks everyone
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by deltarho[1859] »

I migrated from PowerBASIC just over 18 months ago.

Two things immediately spring to mind.

The first one is that parameter passing is ByRef by default with PowerBASIC; with FreeBASIC it is ByVal. Even though a FreeBASIC parameter is being passed ByVal it is good practice to say so.

The second one is that PowerBASIC has negligible typecasting. FreeBASIC's typecasting is very strict. This was a major headache for me for quite a while. If you look at the Windows APIs in the FreeBASIC bi files you will find that the typecasting is as used at MSDN. If you use the Windows APIs and stick to the MSDN type casting you cannot go wrong. Some folk here wander off the beaten track and get away with - they know what works and what does not. I find it safer to stick to MSDN like glue.

I still write code in PowerBASIC but not very often. Whilst FreeBASIC is not second nature to me yet I am working on it so there may be other issues which are no longer an issue for me and I cannot remember what most of them were. <smile>

Your best bet is to post failing code - there are a few PowerBASIC migrants here so you won't be waiting long before someone chips in to help.
currently i'm using Paul's WinFBE and Jose's WinFBX
So am I - a great combination - and authored by two of the best Windows programmers from PowerBASIC. I am sure that Paul will not mind me saying so but, as you probably know already, José is exceptional.

It may take a while but you will eventually realize that FreeBASIC, in many respects, is more powerful than PowerBASIC. Bob Zale's untimely departure and no updates since are starting to show.

At PowerBASIC I am David Roberts. What are you at PowerBASIC, chrisc?
chrisc
Posts: 10
Joined: Dec 04, 2016 18:59

Re: need some tips to convert from Powerbasic to Freebasic

Post by chrisc »

Thanxx a lot Rob

I'm Chris Chancellor at PB forum which i had stopped posting since early this year

i have to dump all my DDT code and learning SDK ones from Jose. Yes both Jose and Paul are the best PB programmers

you too is an excellent PB programmer especially in the field of encryption and decryption
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by deltarho[1859] »

Hmm, I should have checked your posting history. Your first post here was on 4th Dec 2016 with a similar question. That went off-topic quite rapidly and imortis wrote "We are no longer talking about converting from PB to FB." so you started another thread the following day. That got quite a few responses but was also hijacked by another beginner with some code to look at. You did not return to that thread and I don't blame you.

I am not making a comment just an observation that you joined the PowerBASIC forums on 1st February 2017 so I must assume that you were programming PowerBASIC sometime before joining their forum. Eighteen months after your first postings here and you are back with the same question. Let us hope that this time members try to stay on topic.

To a great extent, WinFBX is José's answer to DDT. Knowing some SDK is handy but not essential. You can knock out some useful GUI code with WinFBX without having to learn SDK. Since WinFBX is SDK based you can add some SDK without conflict. With DDT you could add some SDK and get a conflict requiring additional code to get them to 'talk to each other'.

I was doing crypto work at PB for 13 years, long enough to start getting some things right. <smile>
Josep Roca
Posts: 564
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: need some tips to convert from Powerbasic to Freebasic

Post by Josep Roca »

He is already posting questions in my forum and in Paul's forum.
chrisc
Posts: 10
Joined: Dec 04, 2016 18:59

Re: need some tips to convert from Powerbasic to Freebasic

Post by chrisc »

Thanxx Rob

true, bcos of the unavailability of 64bits PB, we have to migrate our codes to FB and O2 so that our applications can
be 64bits. many people have said that it is not possible for the new PB owners to come up with a commercial 64bits compiler
within the next 5 years.

our customers are demanding for 64bits and thus we cannot wait for the new 64bits PB compiler. we are in the scientific software
industry, it is either swim or to die as we need to do complex fast computations where interpreters like VB.net, C# , Xojo cannot provide.

C++ is too tough for us basic programmers to grasp and many people said that it takes at least 10 years to master it.
Purebasic has funny syntax and not basic like, its suitably is questionable
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by jj2007 »

chrisc wrote:we need to do complex fast computations
That means typically using SIMD - and they are equally fast in 32- or 64-bit software. And equally absent in most compilers ;-)

One of the advantages of FreeBasic is that you can easily write parts of your code in assembler.
chrisc
Posts: 10
Joined: Dec 04, 2016 18:59

Re: need some tips to convert from Powerbasic to Freebasic

Post by chrisc »

@jj2007

What we need is a compiler language that
1. can compile to native machine codes 64bits
2. allow for inline assembly
3. basic like and easy to master language -- easy to translate from PB
4. windows base
5. allow for DLL
6. allow interfacing with other laguages like c++ and C#


we are also looking for a PB converter to any language or compiler that satisfied the above criterias
we will BUY it if it exist

FB and O2 (oxygenbasic) have all the attributes that we need as of now

can forget about
qb64 -- already dead
glbasic -- already dead
Basic For Qt -- already dead
Xojo -- does not allow for inline ASM and DLL and compile to pcodes
Truebasic -- already dead
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: need some tips to convert from Powerbasic to Freebasic

Post by caseih »

EDIT: I think I've already gone off topic, sorry, deltarho.

Yeah I don't think we'll ever see 64-bit PB. For that matter I don't think we'll see the continuation of PB at all, even though the new owners claim to be working on it. Sadly I think PB's biggest strength back in the day proved to be its biggest weakness: it was mostly written in assembly. As the platforms change and processor architectures change, assembly code becomes very expensive to maintain and port.

There are math libraries that are extremely fast that you could use from FB, without having to resort to assembly. One library I was told about can customize itself for various platforms while it's being compiled, and produces code that is as fast as hand-craft assembly. Maybe that was "blas" for linear algebra? I can't remember. Anyway there's a partial list of good math libraries here: https://en.wikipedia.org/wiki/List_of_n ... _libraries. In my opinion having fast math libraries to base your calculations on frees you from the confines of any particular language. In other words at that point, the language no longer really matters so you're free to choose whatever works best for you. I'm not sure what kind of complex math you need to do, but much of the scientific computing world runs off Matlab and Python using fast native math libraries, and both are *interpreted* languages.

At some point your customers are going to demand your product work on other architectures besides Intel x86_64. Apple is rumored to be moving their entire product line to their own CPU based on some derivation of the ARM processor. This will not happen for some years yet, but it will happen. With good tools (and avoiding assembly where possible), this jump will hardly even be noticed by end users, and won't be very expensive for developers.

I question that VB.net or C# cannot do complex calculations fast enough. I'm actually fairly confident they can, and do. By the way neither VB.net nor C# are interpreters. They are fast compiled languages. JIT vms can run code as fast or faster than compiled native code. Microsoft is moving more and more into Windows on ARM processors also.

What kind of interfacing with C# and other dot net languages do you require? dotnet allows calling into native DLLs (FB or C) quite easily. Going the other way (calling .net from a language like C or FB) is more difficult but not impossible. Probably requires the use of COM to broker calls and data.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by deltarho[1859] »

caseih wrote:EDIT: I think I've already gone off topic, sorry, deltarho.
chrisc started to drift before you did. <smile>
Yeah I don't think we'll ever see 64-bit PB.
Nor I. Adam Drake owes it to his company to make a profit. I don't think the market is big enough to give him a return on any kind of investment. Having said that it is rumored that Bob Zale was working on a 64-bit compiler so much depends on how far he got with that. Drake's software is written in PowerBASIC so it made sense to get hold of the source code. Bob was exceptional at keeping bugs down to a minimum but if any do appear they will not fix themselves. As a means to continue Bob's work is something that I do not buy into at all. Business is business.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by jj2007 »

chrisc wrote: glbasic -- already dead
Wiki:
Due to the author having problems with ARM64 iOS compilers, various other problems and insufficient time to update the software, the source code (and the forum post about it) was made to those forum members who had a post count of at least 100. The download weighs in at around 2.5 GB compressed.
Hmmm... sounds like fun ;-)
caseih wrote:much of the scientific computing world runs off Matlab and Python using fast native math libraries
Don't forget FORTRAN, still popular in the modelling world.
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by marcov »

caseih wrote:EDIT: I think I've already gone off topic, sorry, deltarho.

Yeah I don't think we'll ever see 64-bit PB. For that matter I don't think we'll see the continuation of PB at all, even though the new owners claim to be working on it. Sadly I think PB's biggest strength back in the day proved to be its biggest weakness: it was mostly written in assembly. As the platforms change and processor architectures change, assembly code becomes very expensive to maintain and port.
PB is not alone, see e.g. Virtual Pascal, another nineties commercial tool with a compiler chiefly in assembler (see http://www.stack.nl/~marcov/vptxt.txt for a short summary that I once wrote, which turned out to be more of an obituary in the long run)

It is often not the compiler source, but everything that is outdated. From RTS source, to patch tools and documentation helpers.

Even a decade after the last non trivial release, people were still waiting.....
Last edited by marcov on Jul 31, 2018 21:10, edited 1 time in total.
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by marcov »

caseih wrote:In other words at that point, the language no longer really matters so you're free to choose whatever works best for you. I'm not sure what kind of complex math you need to do, but much of the scientific computing world runs off Matlab and Python using fast native math libraries, and both are *interpreted* languages.
Mwhaa. Both are primarily used for math prototyping by scientists on heavy workstations. Not to run the same calculation for the umpteenth time on the background on a sales person's thin laptop that is not even plugged in and therefore defaults to 900Mhz, who just wants some quick numbers before making a recommendation. Same for Fortran. Still nr 1 in the academia computational sciences , and pretty much dead outside it.

But in general I agree. It is not about preselecting the "fastest" technology, but about knowing what you are doing. Where is the bottleneck, is it real? Can I simply avoid it by spending $100 more on hardware (which will be default next year, you can't program against that). If not, focus on that bottleneck, and that bottleneck only.

And deployment. Some running enviroments are hard to duplicate and even harder to support that duplication through a telephone line.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: need some tips to convert from Powerbasic to Freebasic

Post by jj2007 »

It is difficult to find benchmarks for math libraries, but here is one, and it seems that Armadillo+OpenBlas is a combi that is hard to beat. However, the Intel MKL was not covered in that test, and it's generally regarded as very fast. University of Utah also has an interesting page.
Some time ago I wrote a GSL interface for my baby, works fine but GSL is rather slow in comparison.
chrisc
Posts: 10
Joined: Dec 04, 2016 18:59

Re: need some tips to convert from Powerbasic to Freebasic

Post by chrisc »

Hi Dave (Deltarho)

how do i contact you?, i have pm you but receive no reply. maybe you can pm me with your email address.

this is in regards to your old pb sll program, i would need an equivalent FB program

Thanks
Post Reply