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...
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 :...
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...
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...
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...
Although it uses iteration, this response in the Lazarus forums works perfectly. while log_TMemo.Lines.Count > 500 do log_TMemo.Lines.Delete(0); ...
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,...
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...
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...
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...
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...
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 ...
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...
dll,import,32bit-64bit,lazarus
No it is not possible. 32-bit EXE loads 32-bit DLL, 64-bit EXE loads 64-bit DLL.
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...
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...
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...
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...
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...
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...
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...
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; ...
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...
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,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...
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. ...
No it does not! Thanks Marco van de Voort for confirming.
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.
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...
Solved the problem. It was wordwrap. Had to divide the memo lines in strings to achieve it but it came out just fine.
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;...
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....
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...
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...
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...