1,364
questions
1
vote
1
answer
64
views
Optimizing C library with global variables for cross-platform dynamic linking in Lazarus IDE
I'm developing a C library for parsing configuration (.ini) files, which I plan to dynamically link with a UI created in Lazarus IDE. Currently, my C code heavily relies on global variables, as shown ...
0
votes
1
answer
25
views
How to configure Visual Studio Code for FreePascal (launch.json)
I'm relatively new to VS Code. I'm trying to configure it to run FreePascal on Windows. I'm trying to follow the instructions of Mr Bee from May 2018. I think this error is from the launch.json:
The ...
0
votes
0
answers
32
views
How can you send key combinations programatically?
Is there a way to send the key combination Ctrl+Alt+Shift+Right-Arrow through code? I am trying to send the active window to another workspace. The key combination works when used manually. I am ...
1
vote
1
answer
91
views
GCC won’t work properly (a conflict with FreePascal)
I’ve installed MinGW and set the PATH, but GCC doesn’t see the included files like stdio.h. I’ve typed where gcc and found out that FreePascal comes with GCC. Apparently my PC is using GCC that comes ...
0
votes
1
answer
48
views
In Lazarus (FPC), how do I get a pointer to a class or record method?
I need to get the address of a method without using RTTI (sometimes it is not even possible to use it in FPC, mostly with records) so that it can be called later, for example, with RTTI.Invoke.
Here ...
-1
votes
1
answer
55
views
unit "compiled with a different version of unit X" ... Are the rules in Freepascal exactly the same as they are in Delphi?
NOTE: This question is about "compiled with a different version of another unit", NOT about "compiled with a different version of the compiler"! Sorry if this was not clear before ...
0
votes
0
answers
36
views
Why my UEFI capsule update code stuck on QEMU UEFI?
This is my Pascal code for UEFI capsule update:
procedure efi_update_firmware(systemTable:Pefi_system_table);cdecl;[public,alias:'EFI_UPDATE_FIRMWARE'];
var ch:array[1..3] of efi_capsule_header;
...
1
vote
2
answers
72
views
How can I hide the black background canvas of a TImage?
I would like draw blue lines onto a TImage, which is a child object of a ScrollBox. But when I drawing, it always shows the black background canvas rectangle under the blue lines. I would like see ...
0
votes
1
answer
55
views
Object Pascal Linked list destructor leaves one block unfreed
Implementing the destructor for this singly linked list class in Object Pascal, why is there always one memory block left unfreed at the end?
I have tried an iterative instead of recursive destructor ...
0
votes
0
answers
32
views
Have anyone know the base position of EFI_DISK_IO_PROTOCOL will change in process when using WriteDisk or ReadDisk?
I am using free pascal to format the virtual hard disk (my base hard disk have maximum 4GiB),but when I execute the uefi app and after that I discovered my hard disk is not formatted in GPT format and ...
-2
votes
2
answers
57
views
Get a window handle knowing the PID of a third-party process in Linux
How is it possible in Lazarus(linux) to get a window handle knowing the PID of a third-party process in Linux. Perhaps an analogue of the function for Windows enumthreadwindows
I looked at the lclintf....
0
votes
0
answers
40
views
How to enable the UEFI File system by programming codes when the LocateProtocol returns efi_not_found?
I met an error when coding in UEFI (LocateProtocol returns efi_not_found(according to UEFI specificiations) and I don't know why)and there is the my pascal code:
These are my codes of UEFI,it is too ...
1
vote
2
answers
157
views
How to print emojis using Pascal on Windows cmd/powershell
According to this table the UTF8 code for the smiley emoji is: F0 9F 98 81.
I attempt to write this output to the console, to no avail:
Program emojii;
{$apptype CONSOLE}
Begin
WriteLn(#$F0#$9F#$...
-2
votes
7
answers
369
views
What is the simplest way to remove multiple spaces in a string in Delphi?
Let's say my string is:
"The fox jumped over the log."
It should then be turned into:
"The fox jumped over the log."
What is the simplest (1-3 lines) to achieve this, ...
0
votes
1
answer
62
views
How to connect to VoiceRSS API with my Lazarus/Delphi program?
On the form of my program, there are TIdHTTP and TButton components:
procedure TForm1.Button1Click(Sender: TObject);
var
HTTP: TIdHTTP;
AudioFilePath: string;
AudioFileContent: TMemoryStream;
...
1
vote
0
answers
61
views
No debugger via text IDE (Go32v2)
I just installed Free Pascal v3.2.2 (within dosbox-x). Unfortunately debugging from the (go32v2) IDE doesn't work. Whatever I do, it says "no debugger support available".
Update: It seems ...
2
votes
0
answers
212
views
Lazarus Android Module Wizard in Free Pascal
When I tried to rebuild Lazarus (because is a requirement if you want to have the LAMW components), I got this error
can't open object file ldResourceStringsOpenSSL.o
and this error
can't open object ...
0
votes
0
answers
46
views
win11, lazarus, brookframework, libsagui-3.dll with tls doesn't work?
Problem solved under the help from author of brookframework.
To use tls, these files should be also put in the same folder of libsagui-3.dll
An error happened with the message:
libsagui-3.dll is not ...
-3
votes
1
answer
165
views
What are reference counted variables in Delphi? [closed]
I know what normal global variables and local variables are, but what are "local reference-counted" variables and "local non reference-counted" variables?
What is it? What's the ...
0
votes
0
answers
134
views
"Error while linking" while compiling empty project using Lazarus (fpc) 32bit on debian-based Linux
I have old 32bit laptop working under MX Linux (v.20230709, 32bit) on which I installed latest Lazarus (i386, v.3.2.2) along with fpc i386, v.3.2.2.
When I create a new empty project of Application ...
-3
votes
1
answer
159
views
How to list all controls which can receive focus, respond to hotkeys and mouse clicks on a visible form in Delphi and FreePascal? [closed]
I am looking for a feature where I can use the keyboard to navigate to or activate any actionable control on a form in one shot.
For those not acquainted with ace-jump in Emacs, or browser addons like ...
0
votes
0
answers
99
views
Uploading files to Synology NAS with frpascal code using FileStation API
I'm playing with a Synology NAS and trying to use its SYNO.FileStation API with freepascal code. All its functions work correctly when I use TFPHTTPClient component GET functions, however when I try ...
0
votes
0
answers
72
views
Preventing Application Freeze During User Input in Lazarus Python Script
I have a Python script that asks for user input:
Python File:
confirmation = input("Enter confirmation (Y/S): ")
LFM File:
object Form1: TForm1
Left = 250
Height = 240
Top = 113
...
0
votes
1
answer
191
views
Free Pascal - Post data to dweet.io with colon in URL
I am playing arround with https://dweet.io/ - the concept is that you can send/post some fields/values to dweet.io and you can see those values published directly there or even see those data as ...
2
votes
0
answers
248
views
"Simcom A7670G GSM Module: Failing to Send Large Data Payload via AT Commands from Raspberry Pi"
I'm working on a project using a Raspberry Pi and a Simcom A7670G GSM module to send data to a server via AT commands. I've successfully sent smaller data payloads using the provided code. However, ...
0
votes
0
answers
132
views
Free Pascal 3.2.2 Generic Max function
How do I implement a simple generic Max function in Free Pascal 3.2.2. Here is my attempt so far:
File: cmn.pas
interface
...
generic function Max<U>(a, b: U): U;
generic function Min<U>(a,...
0
votes
0
answers
141
views
Indy 10 and Xmailer : "Could Not Load SSL Library" or "SSL Error"
I am writing a program on Ubuntu that will send email on the Internet.
I am testing 2 tools/components to see which one works, but every time I try to send an email from my program, I get an error as ...
-2
votes
3
answers
268
views
Illegal Expression on Pascal
program latihan;
uses crt;
var
a, b, c : integer;
d : real;
begin
write('a: ');
readln(a);
write('b: ');
readln(b);
c := a + b;
d := a + b;
sqr(c);
writeln(c);...
0
votes
0
answers
133
views
How to connect opengl_glad 4.6 and glfw to Lazarus free pascal?
I completely redid the code from the last question.It works, but with the standard opengl lazarus and with the glfw library, when glad_gl 4.6 is connected, it issues an external access violation error ...
0
votes
0
answers
133
views
Attempt to connect glad to free pascal opengl 4 6 Error at startup Wrong number of parameters specified for call to gladLoadGL
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
{$R *.res}
Strings,Windows,...
0
votes
0
answers
30
views
how to display labelvalues in the bottom axis in a Box-and-whiskers
I'd like to display the labels of serie, I mean the 7th argument of Box-and-whiskers.addxy(...) below the X bottomaxis and not as marks on the top or middle the boxes.
I tried palying with ...
0
votes
1
answer
701
views
Compiling Pascal code with Lazarus LCL in Linux
I am trying to compile/port on Linux a project which was originally written in Delphi on Windows. I have zero experience with Delphi on Windows and I have only very limited experience with Pascal.
I ...
0
votes
1
answer
212
views
Given a word or set of characters how to only take one part and dispose the rest
I use Free Pascal where I have to do a task for college course (introduction course to programming).
We are not allowed to use certain words from Free Pascal like string, break, and some other ones ...
1
vote
1
answer
258
views
How can I create a TBitSet32 record in Delphi for efficient 32-bit operations?
I am working on a project where I need to manipulate a set of 32 bits very efficiently. Memory efficiency is crucial, so using an array of boolean (which would occupy 32 bytes) is not an option (if I ...
0
votes
2
answers
136
views
I have used so many "if" and I would like to know if I can substitute some by "case"
I have this code:
program Coordenadas;
var
x,z : integer;
begin
writeln('Ingresa la coordenada en X.');
readln(x);
writeln('Ingresa la coordenada en Z.');
readln(z);
if (x=0) and (z=0) ...
0
votes
1
answer
166
views
Is there a Delphi equivalent for GCC's __builtin_popcountl, __builtin_clz, and __builtin_ctz?
I'm currently translating some C++ code into Delphi and came across the following GCC built-in functions:
__builtin_popcountl(x): Counts the number of set bits (1s) in the integer x.
__builtin_clz(x):...
0
votes
1
answer
186
views
Problem with multiple GCC compilers (FPC and MSYS2)
I have a Windows 11 machine with GCC installed using Msys2, which I use to compile C files from my university which always worked flawlessly. The problem is that we have a new course at our university ...
1
vote
0
answers
34
views
Application freezes when 2xclick on the binary but ok if run from a terminal
I have a fpc (free pascal) with msegui widgetset application that compiles ok on OpenBSD.
It runs perfectly when launched from terminal.
But if 2xclick on the binary in the window manager, the app ...
1
vote
0
answers
288
views
Firebird 4 embedded in external folder
I created a "Firebird4x32" folder in which I have all the necessary files to access the Firebird database in embedded mode.
If I copy the content to the root directory of the application (e....
1
vote
0
answers
76
views
how can I fix this error when trying to install fpc with homebrew
im trying to install fpc via homebrew
brew install fpc
but I got an error
Warning: fpc 3.2.2_1 is already installed, it's just not linked. To link this version, run: brew link fpc
and when I use that ...
0
votes
1
answer
537
views
How to use relative file paths in Lazarus
I'm creating a simple CRM in Lazarus with an SQLite backend but I can't figure out how to give Lazarus the file path to the database file relativly. This is needed for when I publish the app as I won'...
1
vote
1
answer
100
views
Why "BlockRead" can use a buffer whose size is smaller than the size of the data being read
I have a program:
program OverflowTest;
var
src: file;
dest: file;
res: longint;
buf: byte;
begin
assign(src, '48_bytes_file.txt');
assign(dest, 'copy_of_48_bytes_file.txt');
...
1
vote
1
answer
55
views
How to get the project source folder in Lazarus? (ComponentEditor)
I understand that a compiled software has no access to the sources. However, this question is intended for the ComponentEditor.
Creating a custom component under LCL & Linux, I am creating now the ...
0
votes
2
answers
74
views
Free Pascal: Excess characters from previous input is written to the file
I'm working on a program to create a simple database, and I'm encountering a problem starting from the second input.
Running result
As you can see, I'm experiencing a problem where the second and ...
0
votes
1
answer
233
views
I got an error when trying to pass a pointer to a procedure in free pascal
everyone! [I'm using free pascal in Lazarus framework]
I'm trying to pass the pointer to integer into a function (or a procedure, it doesn't matter), but free pascal doesn't like it... I've done a ...
0
votes
1
answer
135
views
free pascal bindings for a typedef function inside a DEFINE macro and a number outside
This code is part of the sdl_expt.h and sdl2_expt.h headers, from EyeLink eye-tracking systems. It defines a function pointer type named getExButtonStates using the typedef keyword. The ...
1
vote
0
answers
146
views
Is there any profiler available in recent Lazarus IDE (2.2.6)?
I'm checking out options listed in https://wiki.freepascal.org/Profiling :
gprof
On Windows, it is missing unspecified libraries (MinGW? CygWin?) with no clear installation instructions.
On Linux, I ...
1
vote
0
answers
63
views
Memory Leak in a TWebBroser component in Lazarus
Operating system is Windows 7, Using Lazarus V. 2.2.6. (Pascal)
I am opening a web page repeatedly in a loop and the Memory usage increases with each iteration. Using Task manager, I have looked at ...
1
vote
1
answer
110
views
Access Violation when using SetLength()
I'm writing a connect4 game using Pascal for an assignment. It would by default create a board with the size of 6x7 and win length equal 4, however it can also be passed parameters such as ./connect4 ...
1
vote
1
answer
60
views
Why does read(x) set -31073 to x instead of 99999 when entering 99999 in the terminal
This is a program written in Free Pascal:
program readTest;
var
x: integer;
begin
read(x);
writeln(x)
end.
This is the execution script of this program:
$ echo 99999 | ./readTest
-31073
$
...