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

Delphi:Is a temporary PChar guaranteed to have the same value after a string variable pointed by the PChar is changed?

The following code runs as expected in my system, but I'm not sure whether the P variable is guaranteed to have the same value after MyArray[0] is changed to a new value. procedure Test; var MyArray: array of string; P : PChar; begin …
Astaroth
  • 2,241
  • 18
  • 35
6
votes
2 answers

How can I call a Delphi function that returns a string using JNA?

I'm working on calling functions from a Delphi compiled *.so file from a Java program. After some research it seems like JNA is he way to go. Before diving into some complex Delphi code, I'm trying to play with some "Hello World" code but am having…
Christophe L
  • 13,725
  • 6
  • 33
  • 33
6
votes
1 answer

Differences in Form Initialization between Delphi and Lazarus?

MainForm creates some secondary Frame objects at runtime to display various option panels. Here's a typical constructor for one of those frame classes (they each extend TFrame): constructor Tframe2.Create(AOwner: TComponent); begin inherited; …
Jessica Brown
  • 8,222
  • 7
  • 46
  • 82
6
votes
2 answers

function Copy() in Free Pascal

Delphi allows 3 versions of the Copy function: function CopyTest(const S: string): string; begin Result:= Copy(S, 1, 5); Result:= Copy(S, 1); // Result:= Copy(S); // not allowed for strings, allowed for dyn arrays end; FreePascal seems to…
kludg
  • 27,213
  • 5
  • 67
  • 118
6
votes
1 answer

Free Pascal for Android on MIPS

Trying to port a Delphi library to Android. Free Pascal has Android/ARM support - a prebuilt compiler for Windows is available. However, Android NDK now supports MIPS and x86 as well. What's the status of support for those in FPC? For now, my…
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
5
votes
3 answers

Reading a file in FreePascal

I have a text file with specified structure, namely (for each line): char, space, char, space, double value, endline. For instance q w 1.23 e r 4.56 t y 7.89 What is the proper way to "extract" those values in Free Pascal?
Clueless
  • 605
  • 3
  • 10
  • 19
5
votes
3 answers

Writing code for a Mac using Lazarus

I have done a little work on lazarus' free pascal. So when a client asked me to write an application for a mac, after the initial, "it can't be done" stage. (followed by an asp.net maybe stage) i thought about writing it using lazarus. Question is.…
Daniel Casserly
  • 3,552
  • 2
  • 29
  • 60
5
votes
2 answers

Algorithm smbPitchShift (Pascal)

I looked for a long time this algorithm in Pascal and not found, I found it only in C++, it was frustrating. Then I decided to translate the C++ code for Pascal, however there were some problems that I am not able to solve. it appeared an error…
Carl
  • 111
  • 9
5
votes
1 answer

Unable to enter critical section

Why is it imposible to enter critical section without Sleep(1)? type TMyThread = class(TThread) public procedure Execute; override; end; var T: TMyThread; c: TRTLCriticalSection; implementation procedure TForm1.FormCreate(Sender:…
5
votes
2 answers

Is there a Template Engine like Velocity or Freemarker for Delphi?

For web applications, it would be helpful if Delphi object properties and methods could be "connected" with HTML code. This could be used in many ways, both during the HTML response build stage and the request processing stage: access a server-side…
mjn
  • 36,362
  • 28
  • 176
  • 378
5
votes
1 answer

Backtracking in Pascal: finding maximal weighted branch

I've been learning Pascal (using the Free Pascal compiler) for a week now, and came across a seemingly easy exercise. Given a structure as shown below, find the maximal weighted branch: 1 4 9 7 0 2 4 8 6 3 A branch is any sequence of…
5
votes
2 answers

How to compile P4 from source code?

I am a student in Computer Science, and I am learning programming with Pascal. I have found an interesting Pascal compiler, P4 (http://homepages.cwi.nl/~steven/pascal/). To know more about Pascal, I am trying to compile their source code, but I…
fpj
  • 315
  • 1
  • 14
5
votes
1 answer

FPC : RTTI on records

This is my first time on this site. Usually, I have no problem to found replies in the old posts but I don't success with my actual problem. I would like to know how use RTTI functions to know at running time the properties/members of a record under…
5
votes
3 answers

Delphi equivalent to Free Pascal's FPC define?

Is there a compiler define that tells if source code is compiled with delphi, in the sense of an equivalent to the FPC define in Free Pascal? I am developing a unit that should be compatible with three Pascal compilers (Lazarus / Free Pascal, Delphi…
jwdietrich
  • 474
  • 6
  • 17
5
votes
1 answer

Problem with WM_COMMAND on Lazarus/FPC

I have form with MainMenu and I want to intercept when the user selects a command item from a menu. This works in Delphi: type TForm1 = class(TForm) ... // Memo and MainMenu created protected procedure WMCommand(var Info: TWMCommand);…
Michał Niklas
  • 53,067
  • 18
  • 70
  • 114