Questions tagged [fpc]

FPC (Free Pascal Compiler) is a 32/64-bit multi-architecture Object Pascal compiler with both Turbo Pascal, Apple Pascal and Delphi dialects.

FPC (Free Pascal Compiler) is a 16/32/64-bit multi-architecture Object Pascal compiler with both Turbo Pascal, Apple Pascal and Delphi dialects.

Free Pascal is the compiler core under the Lazarus RAD project, which provides a portable Delphi-like IDE and RAD. Lazarus has its own tag on Stackoverflow.

However Free Pascal is used directly for server/web/control apps too.

Free Pascal currently supports x86/x86_64, powerpc/powerpc64, sparc and assorted ARMs, and most popular OSes.

8086 (16-bit x86), m68k and Mips are in advanced stages of preparation in the development branch.

164 questions
2
votes
1 answer

Where or How, can I hook my code to the Unix signals(SIGHUP mainly) on a TDaemonApplication?

After hitting the snag on the Apache module I've turned to a Daemon Application(TCustomDaemonApplication) that is also needed for my project. Once I realized that there were no obvious way to hook to *nix signals, and the one I'm looking is SIGHUP…
Gustavo Carreno
  • 9,499
  • 13
  • 45
  • 76
2
votes
1 answer

When is it safe to cast UnicodeString to string in Free Pascal 3?

This unit test runs successfully with Free Pascal 3.0 in Delphi mode: procedure TFreePascalTests.TestUTF8Decode; var Raw: RawByteString; Actual: string; begin Raw := UTF8Encode('关于汉语'); Actual := string( UTF8Decode(Raw) ); // <--- cast from…
mjn
  • 36,362
  • 28
  • 176
  • 378
2
votes
2 answers

FPC BASM32 MUL bug?

I come across a problem while porting Delphi BASM32 code to FPC: program MulTest; {$IFDEF FPC} {$mode delphi} {$asmmode intel} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF} function Mul(A, B: LongWord): LongWord; asm MUL …
kludg
  • 27,213
  • 5
  • 67
  • 118
2
votes
0 answers

Procedures variables is empty in Kernel

My operating system's kernel is written in pascal but procedures in it is not working.Example: procedure Blabla;.... begin Sample(6); end; procedure Sample(Smp:Longint);stdcall;[public,alias:'Sample']; begin ... //Smp is always null (Smp's value is…
user2590769
  • 75
  • 1
  • 10
2
votes
1 answer

Setting up FPC and Lazarus for iOS development on Mac

I have tried to follow an article which is supposed to work to make an iOS dev enviroment work with FPC and Lazarus, but like always, nothing works the first time. The article can be found here: http://blog.naver.com/simonsayz Everything in that…
vaid
  • 1,390
  • 12
  • 33
2
votes
1 answer

FPC string to widestring conversion on OSX

The conversion to/from WideString on OSX doesn't work for me. In a large program, all strings are assumed to be UTF-8 and everything works fine. Recently, a library using WideString has been added and it works nicely on Linux, but fails on OSX. All…
maaartinus
  • 44,714
  • 32
  • 161
  • 320
2
votes
2 answers

How do I add a .chm help file to my application built in Lazarus?

The only documentation I can find online points me to a demo application called Ihelp which doesn't appear to exist in my version of Lazarus (v1.2.4). I've created my .chm help file and just want to make it available when the user presses F1 (or…
Fat Monk
  • 2,077
  • 1
  • 26
  • 59
2
votes
2 answers

Pascal CloseFile not found

I have been making a program in Delphi and what I am trying to do is set up me game with a 'save file'. I have been doing this in Delphi and not when I bring the code home I am just using a pascal compiler and I cannot seem to run my program as I…
Sam Collins
  • 443
  • 5
  • 13
2
votes
1 answer

Naked 64-bit asm functions in Delphi and FPC

Are FPC's nostackframe and Delphi's .NOFRAME directive exactly equivalent in 64-bit asm functions? In other words does the next code template procedure Naked(SomeArg: Integer);{$IFDEF FPC}nostackframe;{$ENDIF} asm {$IFNDEF FPC} …
kludg
  • 27,213
  • 5
  • 67
  • 118
2
votes
2 answers

FPC does not define CPU386 symbol for 64-bit processors

The next application program Project1; {$IFDEF FPC} {$mode delphi} {$ENDIF} begin {$IFDEF CPU386} Writeln('CPU386'); {$ENDIF} Readln; end. produce different output in Delphi(XE) and FPC(2.6.2) on my system (Win7 64 bit, CPU intel core…
kludg
  • 27,213
  • 5
  • 67
  • 118
2
votes
2 answers

RawByteString type in Free Pascal

Free Pascal docs state that RawByteString type is defined in Free Pascal but I cannot find where. One should expect that it is defined in System unit, like in Delphi, but when I compile (using FPC 2.6.2, {$mode delphi}) a function declaration class…
kludg
  • 27,213
  • 5
  • 67
  • 118
2
votes
1 answer

Create a fkInternalCalc field on TSQLQuery

The following Delphi function can be used to add a fkInternalCalc to a TClientDataset. This is useful because I can store some information for each record, make calculation or store temporary flag. The same code does not work in Lazarus, it stops on…
Jako
  • 2,489
  • 3
  • 28
  • 38
2
votes
3 answers

SIGSEGV when using interfaces

Please take a look at the following Free Pascal program. type IMyInterface = interface end; TMyClass = class(TInterfacedObject, IMyInterface) end; var MyInstance: TMyClass; procedure DoSomething(MyParameter:…
nils
  • 1,362
  • 1
  • 8
  • 15
2
votes
1 answer

ObjectBinaryToText error with a TReader/TWriter helper class

I've created two simple helpers to make TWriter.WriteProperties() and TReader.ReadProperty() public, based on this example. It works fine when saving the persistent things in binary object format but fails when converting to text. Any idea about how…
Abstract type
  • 1,901
  • 2
  • 15
  • 26
2
votes
1 answer

Why is WPO(whole-program optimization) not doing any improvements in my program size? (FPC 2.4.0)

I use FPC 2.4.0 for WinXP(binary from the official page), also tryed with same version but compiled from source on my comp. I put something like this: I:\pascal\fpc-2.4.0.source\fpc-2.4.0\compiler\ppc386 -FWserver-1.wpo -OWsymbolliveness -CX -XX…