Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Lazarus features in a non-graphical environment
« Last post by jollytall on Today at 11:53:17 am »
I have a command line program running on a Linux server somewhere far in a datacenter. It uses Indy for networking. The program was running for a long time, but now I needed to make some cosmetic changes, but I could not compile the source, and later could not run the executable. Details are in a Networking thread: https://forum.lazarus.freepascal.org/index.php/topic,67027.0.html

Now I made some more checks and came across a number of problems:
- Paweld recommended to add Interfaces to the uses clause. After doing so, my program with Indy compiled but the executable got much-much larger (13.2MB instead of 3.5MB). I checked the Interfaces unit and it is related to gtk2 and forms, although as said above my program is a service running with no GUI, and even more not even accessing a terminal. So, I am totally confused why adding Interfaces was necessary to use Indy.
- Nonetheless, I can live with the extra large executable, but it did not run. The reason apparently is that the server is an older Linux than my Desktop, so the program does not have the right libraries. It is a bit bothering that FPC/Lazarus can cross-compile from Linux to e.g. Windows, but cannot cross-compile it to another Linux. Can there be an easy solution?

But then again, I can also live with this, if I compile the program on the server (sub-optimal solution, but anyway). However, I do not know how to do that. I have IndyLaz and other packages added as required packages in the Project Inspector of Lazarus. Although, I did compile other programs with FPC only, those were simpler ones. I do not know, how to do an FPC compilation, using these kind of Lazarus features. It is obvious that I cannot have Lazarus running, but then what sort-of makefile or config file is needed to compile Lazarus projects with FPC only.

Can you help in this last question, but would also be happy to get comments on the Interfaces question as well (the Linux version was detailed in the other thread, but any better idea is again welcome).
2
First, a big thank-you to all who helped!

Simply removing all 'prepare' calls from our source code seems to have fixed the problem (at a superficial level at least).

My priority has to be implementing the required changes to our code, rather than debugging the fpc library.
So I shall consider the case closed - it seems that the problem is known ( see comments in TCustomSQLQuery.BeforeRefreshOpenCursor ), and since this was known several versions ago I assume that fixing it was not trivial. I hope someone will tackle this in the near future!
3
Third party / Re: Ho Ho Ho IntraWeb in Lazarus!!!
« Last post by irawan on Today at 11:39:39 am »
any news on this special product?
4
Debugger / Re: FpDebug questions
« Last post by Martin_fr on Today at 11:25:02 am »
The line order in the asm, is due to what FPC said for each address which line it was.

If you step (or try to step in) this lines, then you will notice it goes back and forth too. => as each param gets prepared, and then put in place for the call. Or something like this, whatever criteria fpc used to attribute each asm statement to either line.



The handle for the file can be set (seeked) to the begin or end of the file.

E.g. if you want to "tail" that file, if it still gets written to.
5
General / Re: Parameter passing oddities
« Last post by Thaddy on Today at 11:23:20 am »
Basically that is legal, because c1 is passed in and subsequently passed out in a different guise.. At the point of the calculation the first C1 is treated as const, but the result calculation that is passed out changes C1 in a legal way, since it is a store outside of the procedure itself.
const is confusing, but not that confusing.
Which is less disturbing than this:
Code: Pascal  [Select][+][-]
  1. var
  2.   i:integer;
  3. begin
  4.   for i := 0 to 10 do
  5.   begin
  6.    writeln(i);
  7.    inc(pinteger(@i)^);
  8.   end;
  9. end.
Which should be illegal, but isn't...
They are related, though.
6
General / Re: splitting an image
« Last post by Dzandaa on Today at 11:15:40 am »
Hi,

You cant try this skeleton (using BGRABitmap)

B->
7
General / Re: how to tweek fpmake to compile RTL?
« Last post by marcov on Today at 10:35:11 am »
So to be clear: the rtl, toplevel and compiler makefiles use an older build system; makefiles generated from a template by FPCMAKE and fpmake

Before say 2015, nearly everything was like that.
8
General / Re: splitting an image
« Last post by TRon on Today at 10:34:19 am »
the image is loaded like this from a TImageList. It is depended on a color:
That answers at least one of my questions ....  :P

Ah well, let's see how far you are able to get with the following (you would have to adjust to meet your specific requirements).

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   sameArea: TRect;
  4.   srcRect: TRect;
  5.   dstRect: TRect;
  6. begin
  7.   // split original image into two separated ones
  8.  
  9.   // left part of original image has the exact same rectangle coordinates as
  10.   // the destination image and is 165 pixels width.
  11.   sameArea    := Bounds(0,0,165, Image1.Height);
  12.   // Copy rectangle area from image1 (leftmost part) to image2
  13.   Image2.Canvas.CopyRect(sameArea, Image1.Canvas, sameArea);
  14.  
  15.   // right part of original image is located 165 pixels from the left
  16.   srcRect := Bounds(165, Image1.Canvas.ClipRect.Top, Image1.Canvas.ClipRect.Width-165, Image1.Canvas.ClipRect.Height);
  17.   // copied image starts at topleft of canvas and is 200 pixels width
  18.   dstRect := Bounds(  0,                          0,                              200, Image1.Canvas.ClipRect.Height);
  19.   // copy rectangel from image1 (rightmost part) to image3
  20.   Image3.Canvas.CopyRect(dstRect, Image1.Canvas, srcRect);
  21. end;
  22.  
9
Beginners / Re: Can function be used for change event
« Last post by Thaddy on Today at 10:24:31 am »
You can look at how the modified property is implemented for edit/memo
You can also have a look at the observer/observed pattern that is available for any control
https://www.freepascal.org/docs-html/rtl/classes/ifpobserved.fponotifyobservers.html
Also note that you can indeed define a function, since TMethod accepts not only a procedure, but also a function.



10
General / Re: splitting an image
« Last post by madref on Today at 10:18:58 am »
the image is loaded like this from a TImageList. It is depended on a color:
Code: Pascal  [Select][+][-]
  1.   case KleurPop of
  2.     Oranje : ImageList_Divisie.GetBitmap(0,Image_Divisie.Picture.Bitmap); // Oranje
  3.     Rood   : ImageList_Divisie.GetBitmap(1,Image_Divisie.Picture.Bitmap); // Rood
  4.     Blauw  : ImageList_Divisie.GetBitmap(2,Image_Divisie.Picture.Bitmap); // Blauw
  5.     Groen  : ImageList_Divisie.GetBitmap(3,Image_Divisie.Picture.Bitmap); // Groen
  6.     Paars  : ImageList_Divisie.GetBitmap(4,Image_Divisie.Picture.Bitmap); // Paars
  7.     Geel   : ImageList_Divisie.GetBitmap(5,Image_Divisie.Picture.Bitmap); // Geel
  8.     Zwart  : ImageList_Divisie.GetBitmap(6,Image_Divisie.Picture.Bitmap); // Zwart
  9.   end;  // case
the idea was to, if possible, split this image into 2 images. So the idea is to have 2 TImage placeholders
1 is holding the left part of the image and the other 1 is holding the right part of this image.
i have added an example image
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018