Recent

Author Topic: Compiling a converted unit from Delphi7  (Read 9933 times)

Strassi

  • New member
  • *
  • Posts: 9
Compiling a converted unit from Delphi7
« on: February 05, 2013, 04:51:08 pm »
I'm new to Lazarus. Used to work in Borland TP and TMT pascal. Got Delphi7 working in de console mode. All my old TP Pascal files are running. Compiled the console unit from R.Velthuis (.dpr) to .dcu and copied it in de proper directory. Everything works fine. Like to do the same with Lazarus-FPC. Converted thoa.dpr to .pas in Lazarus. Try to load/compile the converted file to .ppu and .o . but that does not seem to work. Can't find the compiled files. Does no realy know if I had to laod the converted pasfile in the editor as a project, unit or console application. Seems always to compile a empty unit in the page left from the source file in the editor  (marked with a '*').
Thanks for any help.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Compiling a converted unit from Delphi7
« Reply #1 on: February 05, 2013, 05:10:41 pm »
Quote
Converted thoa.dpr to .pas in Lazarus.
Are you sure .dpr was converted to .pas? Did you do that manually?

You can use the Delphi converter in Lazarus to convert .dpr files. It should generate an .lpr file.

Also, you can try compiling a .pas file with a console mode program directly with fpc, e.g. fpc bla.pas.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Strassi

  • New member
  • *
  • Posts: 9
Re: Compiling a converted unit from Delphi7
« Reply #2 on: February 05, 2013, 06:06:56 pm »
Thanks for the reply BigChimp. Made a error. I did the conversion from *.pas (delphi) to *.pas (lazarus) via the convertor in Lazarus. But I still can't compile the converted console.pas unit into *.ppu and *.o files. When I open the pasfile I still have a blanc unit structure in a previous page.


----------------------------------------------------------------------------------------------------------------------------------------------------------
Lazarus v 1.0.4   FPC 2.6.0  I386-win32 win32/64   Win7 64

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Compiling a converted unit from Delphi7
« Reply #3 on: February 05, 2013, 06:24:58 pm »
Sorry, no idea what's going on (except that you keep saying you converted .pas files while you should be converting the Delphi .dpr project)

You could attach the original Delphi project if it's not confidential.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Strassi

  • New member
  • *
  • Posts: 9
Re: Compiling a converted unit from Delphi7
« Reply #4 on: February 05, 2013, 08:18:27 pm »
Hey BigChimp.
I thought that I could compile the received console.pas file in a console.dcu file (Delphi7). I think this was an error because, included in the zipfile was a second file named consoleDemo/dpr. which I compiled and ran to see what the dpr was doing. This run generated the console.dcu which I succesfuly copied in the unit directory. So  now all my old TP programs were running fine calling the console unit in the proper Delhi directory.
I thought that I had succesfully compiled it from the console.pas file. So I tried desparately to convert the console.pas file in Lazarus and do the same as in Delphi7. But when you repeatedly  mentioned me that it had to be a .dpr file that had to be converted, I run the converted consoledemo.dpr in Lazarus. Sadly the compiling halted because of three errors in the console unit. So I did not get the console.ppu and console.o files.  So I can run my old TP programs in the console mode in Delphi7 (with deleoln, gotoxy, readkey, etc...) but sadly not in Lazarus-FPC. Thanks again for your help. The errors in the consule-unit are complex. I send you in a attachment the zip-file with the delphi source. Perhapse you know somebody to resolve the problem or perhapse you know another console unit which works with Lazarus.
Yours truly.
PS: the reason for al this is that in Belgium 15yr old pupils which are using TMT pascal with there XP-computers can easily switch to object programming and still having the possibility to work in the consule mode on windows 7 and 8. They haven't to learn another language, like VB or C# getting a free IDE.


----------------------------------------------------------------------------------------------------------------------------------------------------------
Lazarus v 1.0.4   FPC 2.6.0  I386-win32 win32/64   Win7 64

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Compiling a converted unit from Delphi7
« Reply #5 on: February 05, 2013, 09:26:13 pm »
You probably don't need console.pas at all.

The header comment says:
Quote
Function:   Console unit, similar to the Crt unit in Turbo Pascal.

Lazarus/Freepascal has a crt unit.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Compiling a converted unit from Delphi7
« Reply #6 on: February 05, 2013, 11:53:50 pm »

PS: the reason for al this is that in Belgium 15yr old pupils which are using TMT pascal with there XP-computers can easily switch to object programming and still having the possibility to work in the consule mode on windows 7 and 8. They haven't to learn another language, like VB or C# getting a free IDE.


1) you can create simple console application with lazarus no need for anything extra
2) free pascal compiler has a console mode editor that emulates the turbo pascal IDE which you can use directly.
3) both environments support procedural and object oriented programming.
4) What makes you thing that using lazarus or free pascal ide will force your students to learn a new language? especial vb or c#?
5) free pascal compiler has various compatibility modes take a look at http://www.freepascal.org/docs-html/prog/progsu92.html#x99-1000001.2.16
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Strassi

  • New member
  • *
  • Posts: 9
Re: Compiling a converted unit from Delphi7
« Reply #7 on: February 06, 2013, 12:28:48 am »
Thanks Theo. Did not know the crt unit existed in Lazarus-FPC. Have tried it and it works fine.

Strassi

  • New member
  • *
  • Posts: 9
Re: Compiling a converted unit from Delphi7
« Reply #8 on: February 06, 2013, 01:05:09 am »
taazz wrote:
Quote
"4) What makes you thing that using lazarus or free pascal ide will force your students to learn a new language? especial vb or c#? "

What I ment was that the students of 15 yr are now programming small excercises in TMT-Pascal with procedures and functions. But TMT-Pascal does unfortunatly not work full screen in windows 7. In the schools PC's are running more and more on windows 7 or 8. It would be nice if they could work with a IDE in which they could use their old skills in a console environment and in the same time learn about a object in a GUI. Therefore Lazarus-FPC seems to be an excellent choice. It is free, and the students do not have to switch to a new language (like VB, C#, ...). They still can recognize the Pascal syntax and everybody can have a copy of the free IDE at home.
Thanks anyway for the help.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Compiling a converted unit from Delphi7
« Reply #9 on: February 06, 2013, 08:53:33 am »
Ok, clear enough. Had a look at your code, tried replacing Rudy Velthuis' console.pas with FPC's built in crt but it misses some functions you use.

Perhaps somebody who's familiar with CRT programming can convert the program...

... or perhaps you could consider migrating to Lazarus and
1. Start with simple traditional (non-crt) Pascal programs first (readln, writeln)
2. Graduate to Lazarus object-oriented programming with widgets
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Strassi

  • New member
  • *
  • Posts: 9
Re: Compiling a converted unit from Delphi7
« Reply #10 on: February 06, 2013, 11:57:13 am »

Quote
BigChimp quote:

... or perhaps you could consider migrating to Lazarus and
1. Start with simple traditional (non-crt) Pascal programs first (readln, writeln)
2. Graduate to Lazarus object-oriented programming with widgets

Thanks for looking at the code.
Will follow yr advice
Grtz

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Compiling a converted unit from Delphi7
« Reply #11 on: February 06, 2013, 02:33:06 pm »
I made some minor changes to console.pas unit, and it now compiles and seems to run (it even plays some old style TP "music").

I left some comments
//converted from:
so you can see what I did.
I also copied all VK_XXXX constants from LCLTypes unit, you strip out the ones that are not used.

Attached consoledemo.zip contains the converted and project with the changes I made to console.pas.

Bart

Strassi

  • New member
  • *
  • Posts: 9
Re: Compiling a converted unit from Delphi7
« Reply #12 on: February 15, 2013, 04:52:24 pm »
Thanks for the changes Bart. Sorry for the late reply, but I went skiing for a few days.
Have a additional problem. Every time I start the Lazarus editor, the previous project or program (in the console mode) starts. If I load an existing program from disk it loads but after compiling always the previous program/project runs. Although I clos the page, it still runs again. How do I fix this editor problem. As I mentioned earlier i am new the IDE. Did not find an answer in de FAQ's. What lazarus editor manual would you recomend. Grtz.

----------------------------------------------------------------------------------------------------------------------------------------------------------
Lazarus v 1.0.4   FPC 2.6.0  I386-win32 win32/64   Win7 64

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Compiling a converted unit from Delphi7
« Reply #13 on: February 15, 2013, 05:32:54 pm »
Please post new questions in a new thread with a descriptive title. That helps get interested eyes on your problem as well as keeping things organized...

BTW: Lazarus 1.0.6 has been released and contains fixes; I'd suggest installing that for the problem fixes it has.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018