Questions tagged [freepascal]

Free Pascal is a multi-dialect, multi-platform Object Pascal compiler. Originally started to replace the retired Turbo Pascal compiler, it now attempts to follow the Delphi dialect still being developed by Embarcadero Technologies. It has compiler modes for Delphi, Turbo Pascal and Mac Pascal. It also has two modes for its own superset dialect: One mode with exceptions, classes and interfaces, and mode one without.

Free Pascal is a multi-dialect, multi-platform Object Pascal compiler. Its main focus are the Delphi and Turbo Pascal dialect, but a substantial Mac Pascal subset and a minor ISO Pascal mode exist as well.

Free Pascal is available for most common architectures and operating systems.

http://www.freepascal.org

1338 questions
6
votes
2 answers

What would be involved in getting Free Pascal to compile into AVR, ATMega and Arduino?

Would it be too much of an effort to have FPC compile to the Arduino platform? I would really like to use Lazarus to do some "sketches".
Gustavo Carreno
  • 9,499
  • 13
  • 45
  • 76
6
votes
4 answers

FPC IDE: Can't find unit system

I just installed FPC 3.2.0 (on Linux Mint 19.3) and trying to use FPC IDE. I launched the IDE from the bin installation subfolder as ./fp, written a simplest program in IDE program hello; begin writeln('hello'); end. saved the program as…
kludg
  • 27,213
  • 5
  • 67
  • 118
6
votes
2 answers

My Pascal program is warning me about unreachable code

Why is pascal giving me unreachable code in line (8,21) and (8,12). I don't know why its a simple code for making an octal number of 3 digits to decimal. The program is ok because is giving me the right result, but I don't know why free pascal is…
6
votes
4 answers

How to convert integer whole value to 3 digit dot seperated string

I can't believe I am struggling so much with this! Hopefully it is an easy one. Using either Delphi or Freepascal: Given the whole integer value "1230", or "1850", how do you format that as a floating point string of 3 digits where the decimal is…
Gizmo_the_Great
  • 979
  • 13
  • 28
6
votes
1 answer

OSX app crashing: code signature invalid

I have an OSX app that I distribute outside the AppStore. Therefor I sign it with the according certificate (Developer ID Application Certificate). The app itself is written in Freepascal (Lazarus) and has a dependency lib, written in C++, which I…
simonescu
  • 462
  • 5
  • 17
6
votes
2 answers

How to create an associative array in Pascal using arrays for the values

I've this file: Bulgaria = Bulgarian Croatia = Croatian Austria = Croatian Czech Republic = Czech Slovakia = Czech Denmark = Danish Germany = Danish Belgium = Dutch Netherlands = Dutch Ireland = English Malta = English United Kingdom =…
Mariano R.
  • 161
  • 1
  • 5
6
votes
1 answer

Building Delphi project from Visual Studio Code

I have already set up build and debug environment for Object Pascal inside Visual Studio Code via FPC and GDB, but I just made build process work for programs containing only 1 .pas file via "command": "fpc", "args": [ "-g", "-Px86_64",…
Lukas Salich
  • 959
  • 2
  • 12
  • 30
6
votes
2 answers

Do Pascal compilers need SecureZeroMemory function?

Consider the code: procedure DoSmthSecret; var Seed: array[0..31] of Byte; begin // get random seed .. // use the seed to do something secret .. // erase the seed FillChar(Seed, SizeOf(Seed), 0); end; The problem with the code is: FillChar…
kludg
  • 27,213
  • 5
  • 67
  • 118
6
votes
0 answers

FPC BASM32 POP bug?

Another discrepancy between Delphi and FPC BASM: program PopTest; {$IFDEF FPC} {$mode delphi} {$asmmode intel} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF} var B: LongWord; procedure Pop(A: LongWord; var B: LongWord); asm PUSH EAX …
kludg
  • 27,213
  • 5
  • 67
  • 118
6
votes
1 answer

What is wrong with my if-statement?

I am now trying to explore pascal. And I ran into some compiler errors. I wrote a if else if statement like this: if ((input = 'y') or (input = 'Y')) then begin writeln ('blah blah'); end; else if ((input = 'n') or (input = 'N'))…
Sweeper
  • 213,210
  • 22
  • 193
  • 313
6
votes
4 answers

Unable to read final few Kb of logical drives on Windows 7 64-bit

I'm having some problems addressing logical drives. For clarity, my definition of 'Physical Disk' (PD) is the raw disk regardless of partitioning. 'Logical Drive' (LD) refers to a volume such as Drive E:, Drive F: etc. Using the examples from RRUZ…
Gizmo_the_Great
  • 979
  • 13
  • 28
6
votes
1 answer

Equivalent of C++ std::vector, std::deque and std::map in FreePascal

What's equivalent of std::vector, std::deque and std::map in ObjectPascal (FreePascal compiler)? In brief: (vector) is an auto-resizing contiguous array (deque) is an auto-sizing hybrid array of arrays giving near O(1) random access while allowing…
Kokizzu
  • 24,974
  • 37
  • 137
  • 233
6
votes
2 answers

Assembly calls to System unit functions on FreePascal x64

I have some Delphi/assembly code that compiles and works fine (XE2) for Win32, Win64, and OSX 32. However, since I need it to work on Linux, I have been looking at compiling FPC versions of it (so far, Win32/64, Linux32/64). By and large, it works…
PhiS
  • 4,540
  • 25
  • 35
6
votes
2 answers

Is there a Dictionary object for FreePascal?

It's incredibly impossible to find things for FreePascal because all searches end up at some sort of Delphi related site. Is there a built-in Dictionary object? This page references "TDictionary" under the Generic Classes section, but I have no…
Name McChange
  • 2,750
  • 5
  • 27
  • 46
6
votes
3 answers

How can I keep a Free Pascal console application running "forever"?

In a Linux Free Pascal 2.6.0 console application, a HTTP server is started and runs in a separate thread, so the call to Start will immediately return. begin ... MyHTTPServer.Start; ... WriteLn('Application terminated'); end; To keep the…
mjn
  • 36,362
  • 28
  • 176
  • 378