Recent

Author Topic: Compile Borland Pascal 7.0 code  (Read 6306 times)

Tommek

  • Newbie
  • Posts: 2
Compile Borland Pascal 7.0 code
« on: September 17, 2017, 01:05:27 am »
I have read a lot now that Free Pascal is supposed to have high degree of compatibility with Turbo Pascal and Borland Pascal 7.0. So I tried to compile some old Borland Pascal 7.0 program but I could not even get the compiler past the following line:

uses OWindows, WinProcs, WinTypes, FileDlgs, Strings, WinDos, BWCC, ODialogs, wincrt;

What do I have to do to get this program compiled?

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Compile Borland Pascal 7.0 code
« Reply #1 on: September 17, 2017, 01:33:43 am »
I have read a lot now that Free Pascal is supposed to have high degree of compatibility with Turbo Pascal and Borland Pascal 7.0. So I tried to compile some old Borland Pascal 7.0 program but I could not even get the compiler past the following line:
That is true for the language. {$MODE TP} should be compatible with the pascal language as used in TP.

Quote
uses OWindows, WinProcs, WinTypes, FileDlgs, Strings, WinDos, BWCC, ODialogs, wincrt;
However, Free Pascal does not get shipped with these units as some of them are platform specific. If you have their source-code they would probably compile otherwise a rewrite would be necessary.

Quote
What do I have to do to get this program compiled?
Make sure you have the source-code of the units that are included in your program or rewrite/replace.

My memory is very hazy when it comes to the names of these units, perhaps someone else is able to shed a light on that but i believe some of them are windows 3.x units and afaik Free Pascal does not support win 3.x.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Compile Borland Pascal 7.0 code
« Reply #2 on: September 17, 2017, 02:26:52 am »
Which units can't it find?

Tommek

  • Newbie
  • Posts: 2
Re: Compile Borland Pascal 7.0 code
« Reply #3 on: September 17, 2017, 03:49:41 pm »
Thanks for the answers. So as I understand, compatibility only refers to the compiler itself, not to the compiler system (including units, resource files etc.), right?

Back to the problem: Almost none of the units can be found:
OWindows, WinProcs, WinTypes, FileDlgs, WinDos, BWCC, ODialogs

BP7 only contains the compiled versions of the units. Source files seem to be hard to find, at least I couldn't find any on the internet. Instead of rewriting the units, I guess rewriting the application makes more sense, doesn't it?

So any suggestions where one could get source code for the units or find some advice how to convert the application? I am surprised that I find so little information on the net. I can't be the first to convert old BP7 applications, ... or maybe I am?! :-)

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Compile Borland Pascal 7.0 code
« Reply #4 on: September 17, 2017, 04:46:53 pm »
Instead of rewriting the units, I guess rewriting the application makes more sense, doesn't it?
Absolutely. Writing an application with Delphi or Lazarus is much easier than with the old OWL library of BP.

bee

  • Sr. Member
  • ****
  • Posts: 393
Re: Compile Borland Pascal 7.0 code
« Reply #5 on: September 17, 2017, 04:53:51 pm »
So as I understand, compatibility only refers to the compiler itself, not to the compiler system (including units, resource files etc.), right?
FPC actually isn't only a compiler, it also comes with somekind of standard libraries for classic Pascal languages i.e. system unit, crt unit, dos unit, etc. which some of them are also provided by Borland Pascal 7. Plus, some additional standard packages for modern Pascal languages i.e. sysutils unit, classes unit, dateutils unit, db units, etc. which some of them are not provided by Borland Pascal 7 but available on Delphi. With bonus some more additional useful and cross platform packages from FPC itself i.e. fpweb unit, sqldb unit, etc.

Back to the problem: Almost none of the units can be found:
OWindows, WinProcs, WinTypes, FileDlgs, WinDos, BWCC, ODialogs
These units are not standard libraries for Pascal language. AFAIR, they're units for (old) Windows APIs, probably 16-bit Windows. CMIIW. The units for (modern) Windows APIs might be already available in Lazarus, perhaps you want to check them out.

BP7 only contains the compiled versions of the units. Source files seem to be hard to find, at least I couldn't find any on the internet. Instead of rewriting the units, I guess rewriting the application makes more sense, doesn't it?
Even if you got the source files for those units, some of the APIs may no longer available or have changed in modern Windows system. However, I think it's still possible to modify your app to make it works on current Windows system.

So any suggestions where one could get source code for the units or find some advice how to convert the application?
I suggest you to try compiling your app using Lazarus (with all its Windows units) and modify it as necessary without rewriting the whole app. Well, it may not as easy as it sounds, but I believe it won't be as complicated as rewriting it. Unless your app is a simple app which is not too hard to rewrite it from scratch using FPC.

I am surprised that I find so little information on the net. I can't be the first to convert old BP7 applications, ... or maybe I am?! :-)
I think you're not the first, I have done it myself long time ago. Unfortunately, AFAIR, I didn't share my experience on the internet. I believe most people didn't do it either. Perhaps it's the reason why there is so little information about it on the internet. :)
-Bee-

A long time pascal lover.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Compile Borland Pascal 7.0 code
« Reply #6 on: September 17, 2017, 04:54:35 pm »
Thanks for the answers. So as I understand, compatibility only refers to the compiler itself, not to the compiler system (including units, resource files etc.), right?

Back to the problem: Almost none of the units can be found:
OWindows, WinProcs, WinTypes, FileDlgs, WinDos, BWCC, ODialogs

Yes. Though winprocs and wintypes are succeeded by unit Windows in 32-bits versions (in Delphi).

But support for the BP libraries for Windows 3.x are simply not there, the library compatibility is more the Dos part of TP/BP, not the windows part.

Quote
BP7 only contains the compiled versions of the units. Source files seem to be hard to find, at least I couldn't find any on the internet. Instead of rewriting the units, I guess rewriting the application makes more sense, doesn't it?

There is an another disk for BP7, the so called "object" disc that contains the sources. Some BPs editions don't have it, some (typically advertised as "with objects") do.

Also the language, while very compatible, has been cleansed of the worst platform dependent (read 16-bit dos) features on platforms other than Dos. There is little chance anyway that that code would work blindfolded, since such unit are usually stuffed top-till-bottom with constructions that only mean anything in 16-bits windows apps.

And even if it did, it could only generate a 16-bits win 3.x app.

Quote
So any suggestions where one could get source code for the units or find some advice how to convert the application? I am surprised that I find so little information on the net. I can't be the first to convert old BP7 applications, ... or maybe I am?! :-)

Try to separate the actual application from the GUI, and redo the GUI in Lazarus.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Compile Borland Pascal 7.0 code
« Reply #7 on: September 17, 2017, 05:45:50 pm »
If you have the sourcecode for the framework (I have.. so I know) the missing units from the BP7 WIndows framework can be compiled in FPC without many changes.
It is not the compiler, it is missing sourcecode for the framework. Everything starting with Oxxx (and WinDos, but that is easier to fix without sources)..
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Compile Borland Pascal 7.0 code
« Reply #8 on: October 18, 2017, 04:50:53 am »
Alternatively, you could install DOS with Windows 3.1 in a virtual box and compile everything there (if you would like to compile the original code to see how it works).  :)

Most of the required software can be downloaded:

OSs: https://winworldpc.com/library/operating-systems
Compilers: https://winworldpc.com/library/dev
« Last Edit: October 18, 2017, 04:54:55 am by Munair »
keep it simple

 

TinyPortal © 2005-2018