Menu
  • HOME
  • TAGS

SIGILL Exception in Lazarus

delphi,exception,lazarus,fpc

SIGILL is a signal issued when a illegal instruction is encountered. If the code in your question is resulting in SIGILL that would suggest one of the following: Your executable is corrupt. Your compiler has emitted defective code. You are attempting to execute data rather than code. The final option...

Could I manipulate name of object as string and vice versa? Lazarus/Delphi

string,delphi,object,lazarus

No, this will absolutely not work. The Name of a component is simply a property of that object - it does not constitute any sort of reference to the underlying object. If you want to modify an object you need to pass a reference to that object. For example :...

How to avoid SIGSEGV Errors on FPC compiler?

arrays,lazarus,freepascal,sigsegv

Dynamic arrays have valid indices in the range low(arr) to high(arr) inclusive. And low(arr) is always zero for a dynamic array. You attempt to access an element with index high(arr)+1. That is off the end of the array and is certainly a mistake. Where you wrote for i:= 0 to...

Is there a way to use ONE procedure for multiple buttons in Pascal?

variables,event-handling,pascal,lazarus,procedures

The easiest way to do this is: Number the buttons using the Tag property in the Object Inspector (or in code when they're created) in order to easily tell them apart. (Or assign the value you want to be passed to your procedure/function when that button is clicked.) Create one...

Lazarus(Pascal) RunError(5)

pascal,lazarus

According to Lazarus forum (http://forum.lazarus.freepascal.org/index.php?topic=4936.0): Runtime Error 5 means Access denied. The file maybe readonly and you use the wrong (default) filemode, or you try to re-open the file with a new filehandle without having closed it before (somewhere in the while and repeat loops possibly you assignfile more then...

Truncating a TMemo in Lazarus by removing first X lines

arrays,lazarus,fpc

Although it uses iteration, this response in the Lazarus forums works perfectly. while log_TMemo.Lines.Count > 500 do log_TMemo.Lines.Delete(0); ...

Postgres restore through Lazarus Pascal doesn't work

postgresql,freepascal,lazarus

Executeprocess executes using execve(2), and thus only runs a program + parameters, not a full shell with redirection. So the pipe-in construct won't work, and probably the quoting is also wrong. (since these quotes won't be stripped and will be passed to the receiving program). For unix specific shell use,...

How do you use the SQLQuery component to run multiple queries?

database,delphi,lazarus

You need to close your query before opening it again. If you look at the code for Open on TDataSet it sets the Active property to true. The setting code for Active first checks that the value is different before doing any work: procedure TDataSet.SetActive(Value: Boolean); begin .. if Active...

FPC/Lazarus and Android development? [closed]

java,android,pascal,lazarus,fpc

Please use the official Android Studio provided by Google as it will be a lot easier to search for problems/solutions when you're coding with the Android&Java combination than Android&Pascal

Reading VB6 three-dimensional array in FreePascal/Lazarus

arrays,multidimensional-array,vb6,lazarus,fpc

It clears out that I used damaged data for my research. And I had bad dimension sizes. And I wasn't clear about the dimension order in my algorithms. Only the array data is saved to the file, coding the first dimension at the first place, then the second, and so...

Lazarus Pascal on Android - performance

java,android,performance,lazarus

In other words, is Lazarus running on the Android like a Windows app running on Wine (for Linux)? No. While there is a light preference for Java, native is quite common on Android, and they all need to connect to OS services via a Java skeletal application. If Java...

SIGSEGV error when creating a new form

forms,delphi,lazarus

The only problem with the code you show is that you leak the form. You create it with no owner, and nothing else destroys it. The obvious way to deal with that is to own it: Form2 := TForm2.Create(Self); This may not fix your error but it is the only...

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

delphi,wmi,freepascal,lazarus

Probably, it is a boundary check error. Quote from MSDN (CreateFile, note on opening physical drives and volumes, which you call logical drives): To read or write to the last few sectors of the volume, you must call DeviceIoControl and specify FSCTL_ALLOW_EXTENDED_DASD_IO ...

Threadsafe test / decrement

multithreading,delphi,freepascal,lazarus

It's not thread-safe. Thread 1 reads FCount=1, evaluates condition to True. Thread 2 reads FCount=1, evaluates condition to True. Thread 1 decrements FCount to 0 Thread 2 decrements FCount to -1 Yet I assume the code is specifically intended to prevent reducing FCount below zero. You might want to consider...

Use 32bit DLLs with 64bit Lazarus compiler

dll,import,32bit-64bit,lazarus

No it is not possible. 32-bit EXE loads 32-bit DLL, 64-bit EXE loads 64-bit DLL.

OnClick event handler for control in custom component not working (Lazarus)

delphi,custom-component,lazarus

You store the events into a field but you do not set the controls event. constructor TEditPanel.Create(AOwner: TComponent); begin ... // Assign the current value, but is nil at this moment Edit1.OnClick := FEdit1OnClick; ... end; procedure TEditPanel.SetEdit1OnClick(const AEvent: TNotifyEvent); begin // set a new value only to the field...

Free Pascal: detect “is word char” for WideChar

lazarus,freepascal

I guess there's no simple way to solve this. What's your definition of a letter? Ω (omega) is a letter? is it just a symbol? You would have to manually decide what is a letter and what is not. You could make a big case statement that determines whether a...

How to get the parent directory path of a path in FreePascal/Lazarus?

pascal,freepascal,lazarus

The simplest way is to find the last path delimiter character and trim the source string. BTW there are some alternative: program Project1; uses sysutils; var sExe: string; sParent: string; sParentProper: string; begin sExe := ExtractFilePath(ParamStr(0)); // Get executable directory Writeln(sExe); sParent := IncludeTrailingPathDelimiter(sExe) + '..' + PathDelim; // Make...

Alignment issue in x64 code, Free Pascal

assembly,lazarus,freepascal

It might not be an alignment issue at all. The compiler has given you warning that your absolute reference to SHUFIDX will be truncated to 32 bits. If the address is not within the first 4GiB, that will result in a wrong memory reference. You should check this in a...

Trying to create data transfer rate calculator using Lazarus and Freepascal

delphi,freepascal,lazarus,tdatetime

I feel that you've made this much more complicated than it needs to be. Move your file processing code into a separate thread. Within that code, as you finish processing bytes from the file, use InterlockedAdd to keep a count of the total number of bytes processed. In your GUI...

x64 asm assign value to a by ref parameter works in Delphi, but not Lazarus Free Pascal

delphi,assembly,lazarus,freepascal,calling-convention

I always prefer to be explicit about the registers used to pass parameters when writing asm. It makes it much easier to spot register misuse. So I would write it like this: function Test64(const Val: Int64; var Len: Integer): Integer; asm mov dword ptr [rdx], $1 end; I suspect that...

Lazarus: Install Anchor Docking

raspberry-pi,lazarus,freepascal

You don't add the right unit to your use clause. You must add AnchorDocking, eg: uses classes, sysutils, AnchorDocking; Then in the project inspector, click Add, tab New condition and in Package name field type AnchorDocking: And validate. Also don't forget to check the example in \($LazarusSetupDir)\components\anchordocking\minide which is a...

How can I write to the beginning of a file and insert rather than overwrite data?

pascal,freepascal,lazarus

You may achieve your goal with the following algorithm: Create temporary file; Write your new data to this temporary file; Read all data from target file and append them to temporary file; Rename temporary file to target one; ...

Undo action in StringGrid

delphi,lazarus

You can use the Cols property to save and restore the contents of that column: var MySavedData: TStringList; begin ... MySavedData := TStringList.Create; // Save the contents of the column 1 MySavedData.Assign(StringGrid1.Cols[1]); SortGrid(StringGrid1,1,1,true); // Restore the contents of the column 1 StringGrid1.Cols[1] := MySavedData; ... end; Obviously MySavedData should be...

OSX Keyboard Event Taps with Lazarus / FreePascal

osx,lazarus,freepascal

Pascal and C have different calling conventions. Since you're passing your KeyboardEventTapCB into a function that's going to call it using C calling conventions, you need to make sure it is compiled to expect C calling conventions. Some web searching suggests that you can add cdecl; on the end of...

Delphi, Lazarus - Listbox out of bound (0) TString

delphi,listbox,indexoutofboundsexception,lazarus,tstringlist

The error is telling you that the list box selectedbox is empty. I would expect that the error is more like this: List index out of bounds (0) That tells you that index 0 is invalid which can only mean that there are no items in the list box. Presumably...

Compilation error, can not find Controls used by WSProc

pascal,lazarus

The controls unit doesn't belong to fpc and can not be found in .../fpc/2.6.4/units/.... Instead it's part of lazarus. Search for the "lcl" directory and add it to your ppu path. ...

Does Lazarus support TListBox virtual mode?

freepascal,lazarus

No it does not! Thanks Marco van de Voort for confirming.

Passing data between forms - Ajax Comparison

forms,delphi,lazarus,fpc

Decide in what form to send the data from Main to SecondFrom. For instance in a TStringList. Fill the striglist on the mainform, use it as parameter in SecondForm.Show.

What versions of lazarus and free pascal are stable and compatible

installation,lazarus,fpc

No, both projects provide releases, and these releases are the only ones formally declared stable, currently Lazarus 1.2.6 (from the 1.2 stable branch) using FPC 2.6.4 (also from stable 2.6 branch). Lazarus mentions the prefered version of (release, stable) FPC with every release and for 1.2.6 that is 2.6.4. Of...

keep text formatting when copying and pasting in/from memo

lazarus

Solved the problem. It was wordwrap. Had to divide the memo lines in strings to achieve it but it came out just fine.

Lazarus/FreePascal, Synapse send file to TCPBlockSocket

delphi,freepascal,lazarus,netcat,synapse

Well... Hex 00 00 B5 6C (your extra bytes in reverse) is equal to 46444. So my guess is that TFileStream or SendStream sends the number of bytes it wants to send before the actual data. Looking at the code of Synapse there is the function: procedure TBlockSocket.InternalSendStream(const Stream: TStream;...

64 bit bsr asm is truncating the upper 32 bits

assembly,lazarus,freepascal

Access the 64-bit register as follows: bsr rax, [val] eax is the low 32-bits. ax is the low 16, and al is the low 8....

Lazarus OnKeyPress on OS X

osx,lazarus,onkeypress

Your problem is caused by the fact that OnKeyPress only handles printable ASCII chars. In order to handle non-printable symbols like the tabulator key you should use the OnKeyDown event. Your handler could look like: procedure TForm1.ListBox1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_TAB then form1.ActiveControl...

lazarus grids key-value pair

delphi,freepascal,lazarus,tstringgrid

This is related to the TValueListEditor, and not grids in general. The TValueListEditor is similar in appearance to the Delphi Object Inspector. For brevity, I'll refer to it as VLE in the text below. TValueListEditor.InsertRow takes three parameters: function InsertRow(const KeyName: string; const Value: string; Append: Boolean): Integer; The keyname...

lazarus identifier expected but PROCEDURE found

lazarus

In this case you have to include the uses keyword into your {$IFDEF} as well. If its directive is not defined, the produced code looks like this (notice the orphaned uses keyword): ... implementation uses procedure RegisterWebkitSettings; begin end; So to fix this problem use this instead: {$IFDEF LCLGTK2} uses...