Hi… a new user here. FYI, I’m not a russian and I don’t speak russian either. So, please reply it in english (or indonesian if you could).
I’d like to use CRT unit in PascalABC. Unfortunately,I found some problems and errors.
If I use CRT unit, the IDE refuses to debug my program and forces me to run it without IDE (shift+F9). But if I did it, the compiled program raises runtime error such as this image below. Though I could click ‘Continue’, it’s still annoying. And the most important thing is I couldn’t debug my code.
I found an old issue thread saying we should not use CRT unit because it’s a legacy unit and use the System.Console class instead. But if I put the module in the “uses” section, the IDE complains that it’s unable to find the “System.Console” namespace. If CRT unit is just a wrapper of Console class, then why the IDE is unable to debug it?
An answer on PascalABC’s github said I could simply call the Console class’ methods. But a call to Console’s methods is always producing runtime exception saying ‘the handle is invalid’. So, how to initiate a console window and use to it as Console’s output?
So, if I use the CRT unit then I can’t do debugging, but I can’t use the Console class either. What should I do?
I’m using PascalABC v.3.7.1 (the latest version as I write this issue) on Windows 10.
Hence, the question number 3. How to enable debugging and get rid of the error?
Do you mean there is another PascalABC beside PascalABC.Net? I call it PascalABC just for simplicity e.g. shorter word. I even want to write it as pabc to make it shorter, like fpc. Of course it still refers to PascalABC.Net.
There are LOTS of things missing. I just promoted pascalABC on Indonesian Pascal Community. Their first complain is the documentation is in Russian. Sure, there’s google translate but the translation is not perfect and can be misleading in some particular cases. I wish I knew russian, I’d like to help translate the doc into english. Yes, pascalABC is so good that it worth the effort.
There was, and at least lead dev was same as for this pascal. It’s dead now, because they made whole new language on .Net platform. And all official references were deleted, probably to not have confusion between PascalABC and PascalABC.Net.
But i still see many school tasks for it on forums like cyberforum. And it’s not hard to find bootleg downloads for last version of PascalABC installer on unofficial sites, so i wanted to make sure you didn’t confuse one of those sites with official PascalABC.Net site.
It’s clear enough. But I don’t think it’s a correct solution because I can’t debug anything that’s calling Console’s methods. For example, I’m making a text animation that moving some chars all around the screen. The char position calculation clearly can’t be debugged using your way.
Is there a way to create the console window first than assign the handle to Console? Is it even possible? Because I found many topics related to this on stackoverflow, I just don’t know how to do it in pascalABC.
No need to confuse. I know nothing about other pascalABC. So, I assure you, everytime I said pascalABC or pabc for short, I mean it refers to PascalABC.Net. It’s too long to type it over and over, you know.
For professional or commercial works, yes I agree with you. But for educational purpose it’s still quite interesting, especially using unicode letters and emojis. Here’s some program samples I made using FPC and CRT unit to teach some newbies in Indonesian Pascal Community.
Not really, from all the unmanaged sub-programs it’s one of easiest to call.
You don’t need anything like explicit memory management, not even string encoding conversion.
First open microsoft docs to find out parameters and .dll that contains entry point.
So, there is no arguments and BOOL return value, which in C++ is a 32-bit number that can only be assigned 1 (true) or 0 (false). You can use just integer for it. Or, if you want to make it extra right - you can define own record with 1 privateinteger field and operator implicit's for converting to- and from boolean.
function AllocConsole: integer;
//You can also do this, if you want to change function name in your code:
// external 'Kernel32.dll' name 'AllocConsole';
if AllocConsole=0 then
// Usually you should call WinAPI like GetLastError here,
// to understand exactly what went wrong
raise new System.InvalidOperationException;
Aaand… It at least fails for me. But i never actually researched into how you can fix it, it may also be easy.
As i said earlier - my guess is that it fails because IDE set’s ProcessStartInfo.RedirectStandardOutput when starting your .exe .
Well, i’m kinda too busy rn to research/give more info, so for now you are on your own with this.
Yeah, I’ve tried something similar to that as well, based on some code samples from stackoverflow. And I failed too. So, it’s alright for now. I’m still looking and playing around with pascalABC. Nothing serious.
A simple WriteLine does work but a call to any methods that manipulate cursor or text will produces an error. You have no option but to run the program without IDE and debugger. But what is the point of programming without debugging? Especially for learners or students.