Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
There seems to be some problems in how the PE Executable is linked in the manner you do it. When using the internal linker in FPC it works fine (requires a bit of hacking)

Other than that you have a bug in your efi type definitions. You are missing ConsoleOutHandle

I have attached a version that works fine for me with a trunk compiler. It compiles uefimain as a DLL instead of an executable just to illustrate that it can exit, but the compiler hardcodes the PASCALMAIN entry as no_return for EXEs (it messes up the stack if it does exit and just crashes after fpc_do_exit)
So Can you write a correct linker example file to link all pascal files together?I will refer to it and write my own.
And how to use the internal linker of fpc,which format of EFI file it is?
I have add ConsoleOutHandle to my uefi.pas
2
General / CORBA interface and Variants
« Last post by JdeHaan on Today at 12:51:37 pm »
Hi,

For various reasons I use CORBA interfaces. In my code I also use Variants, to support different types of value in a variable. This may include an interface value.

At some point I need to check if a Variable (of type Variant) is a (CORBA) interface. I use the following code for that:

Code: Pascal  [Select][+][-]
  1. isSymTabEntry := VarSupports(Value, StringToGUID(ISymTabEntry_GUID), SymTabEntry);
  2.  
Here, Value is a variable of type Variant,
ISymTabEntry_GUID, is a string constant, such as:
'{DCD95BA9-90CB-9AA2-0090-DBA0749AF179}'
and SymTabEntry is a CORBA interface ISymTabEntry, defined as :

Code: Pascal  [Select][+][-]
  1.   ISymTabEntry = interface
  2.     [ISymTabEntry_GUID]
  3.     function getName: String;
  4.     //etc…
  5.   end;
  6.  
It doesn’t seem to work. Function getName produces the GUID string constant instead of the name of the SymTabEntry…
Could it be that only COM interfaces can be used with VarSupports?

Is there maybe another way of retrieving an Interface value/variable from a Variant value?

Any suggestion is appreciated.

Regards, J



------------------------------
I use trunk Lazarus and FPC on MacOS Sonoma
3
IIRC, the package "sqlite3laz" which is accessible for installation in "Package" > "Install/uninstall packages", requires the sqlite3.dll to be either in the correct system directory or in the Lazarus directory; otherwise the IDE won't start. On the other hand, when you need sqlite3 you can use the SQLDB library which is installed by default (tab "SQLdb") and does not have this limitation.
4
Now I understand a bit more what you want to achieve.

TAChart starts with the size given to it by its Width and Height properties. Then, in the Draw method (which is called from the Paint cycle), it does all its internal size calculations to fit all its elements into this given rectangle. The ClipRect is only known afterwards. So, I think you can solve your issues by FIRST forcing the chart to draw itself; but don't call Chart.Invalidate which is delayed and not executed immediately; Chart.Refresh maybe should do.

5
There seems to be some problems in how the PE Executable is linked in the manner you do it. When using the internal linker in FPC it works fine (requires a bit of hacking)

Other than that you have a bug in your efi type definitions. You are missing ConsoleOutHandle

I have attached a version that works fine for me with a trunk compiler. It compiles uefimain as a DLL instead of an executable just to illustrate that it can exit, but the compiler hardcodes the PASCALMAIN entry as no_return for EXEs (it messes up the stack if it does exit and just crashes after fpc_do_exit)
6
General / Re: Arabic text, problem on Linux
« Last post by Martin_fr on Today at 12:23:45 pm »
I just checked, and SynEdit only does that if you
- have extra char spacing in the options (which means spaces must be printed between chars....)
- SynEdit detected that there are chars with different width (even in a monospaced font).

For testing, put this in the editor (after making the change from my last post)
Code: Text  [Select][+][-]
  1. MW@XmTi:'Q-MW@XmTi:'Q-
Then set the cursor at the start of line, and select the text, one char at a time.
7

Then I had to do some research to find out why an almost empty CGE game project was showing up as leaking memory in heaptrc just to learn that the Indy network code is intentionally leaking memory and that it's safe to ignore it. Which is bothersome because it makes heapstrc annoying to use on Windows unless I redirect the output to a file.

Note that we don't use Indy. Except client/server examples ( https://castle-engine.io/wp/2024/04/12/improvements-to-our-client-server-tcp-communication/ ). Our web request class (TCastleDownload) is based on FpHttpClient, which is part of FPC.

There was indeed a known memory leak, for which we had a PR: https://github.com/castle-engine/castle-engine/pull/581 .

- Original note: It's not something we want to ignore -- on the contrary, memory leaks are something we treat like any other bug and they have to be fixed. It's just that in this case, this is not so trivial (I want to test and iterate on the solution from PR, as it is a bit cumbersome), and it didn't seem priority (an "almost empty CGE project" doesn't use TCastleDownload, IMHO :) -- but this of course depends on the project type you want to do). You can subscribe to https://github.com/castle-engine/castle-engine/pull/581 on GitHub to be notified when it's applied.

- Edited note: I did some changes and applied PR https://github.com/castle-engine/castle-engine/pull/581 :) No memory leaks should occur anymore. If you observe any leaks in CGE, please submit a bug (using GitHub issues, https://github.com/castle-engine/castle-engine/issues ).

Apologies, I had worded it wrong. I should've said that I used the example TCP server/client networking example on which I later started building my own project on. But the example was already leaking memory prior to me making any changes (thus me calling it an "almost empty project"), to which I discovered that it was because of the way Indy is handling threading and that it's leaking memory on purpose.

I use the Indy package that can be downloaded with the Lazarus package manager. So it might be a bit outdated, and the current version might not be leaky anymore. I haven't checked it.

...

Regarding everything else, it isn't really my intention to critique CGE and make Godot look more favourable. I was pressed on time to finish my post before I had to leave, so I might've rushed a bit.

My idea is that Godot is better for beginners purely because of its popularity, which in turn means that a lot of tutorials (be it good or terrible) are being constantly written by its users, and you can easily get the advice you need from their currently large user base. That popularity also means that they get more financial support to develop the project. Factually speaking, Godot is a stronger project in that sense.

CGE is in peculiar spot. It being written in Pascal might put a lot of folk off (I myself learnt about Object Pascal being a thing just a year or two ago despite learning to program in Pascal for 3 years in high-school and 2 more years at college, yikes!). Our friend circle would always joke about Pascal and how it doesn't have any real world use cases - which isn't true. Our year being the last one to be taught Pascal didn't make it any better since the argument to changing the whole education system to teach C++ instead was based on the premise that it's more useful in the real world and has objects and classes. The prejudice against and the low popularity of Pascal might hinder CGE's popularity greatly, thus making it harder to get that critical mass that Godot has. Which means less user-written tutorials or general advice beginners can get online.

I, myself, currently see CGE to be something more akin to XNA or MonoGame, while Godot seems to be like Unity and Unreal. How true is that is for people to check for themselves as I've only used CGE for just a few weeks and I am not that well versed in the engine or its tools yet. But my opinion here might be unfair to CGE because I dived into code first, mostly ignoring the bundled GUI Castle Editor. However, unlike Unity or Unreal, Godot doesn't have that many commercial successes made with it, and I think CGE actually has an advantage here, being able to compile to machine code thanks to Pascal.

Likening CGE to XNA or MonoGame might be a bit unfair as I find CGE not only easier to use but it also supports proper 3d, which at least when I tried it in MonoGame a few years ago was a pain to do. Not to mention how easy it is to set up on different OSes compared to MonoGame.

Functionally, CGE reminds me of Heaps.io. However, CGE has way more documentation than Heaps.io ever had, and if you do have some prior knowledge of using a game engine, you can find your way around. Not to mention that CGE is built on top of existing quite robust technologies (FreePascal compiler) unlike Heaps.io (having to work with haXe + HashLink + Heaps.io stack of custom mainly gamedev-orientated software, with HashLink not even properly supporting Linux when I had last used it).

I don't think I had played around with CGE or Godot enough to write something of more substance, so I can't really give any proper suggestions.

8
General / Re: Arabic text, problem on Linux
« Last post by Martin_fr on Today at 12:17:41 pm »
I guess that happens in SynEdit.

SynEdit uses the "lpDx" width feature EtxTextOut  https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-exttextouta
On Linux that is emulated (IIRC) by the LCL WS code, which prints the code one char at a time. => which does not work for script languages.

However, without this, many fonts wont be correctly monospaced (at least in my testing, long ago). And that would mean, if you start selecting, and extend the selection letter by letter, then the text on the line starts jumping around... (at least latin based text would...)




To test
components\synedit\syntextdrawer.pp

Code: Pascal  [Select][+][-]
  1. procedure TheTextDrawer.NewTextOut(X, Y: Integer; fuOptions: UINT;
  2.   const ARect: TRect; Text: PChar; ALength: Integer; AnEto: TEtoBuffer);
  3. var
  4.   EtoArray: PInteger;
  5.   {$IFDEF WINDOWS_LIGATURE}
  6.   W: WideString;
  7.   Glyphs: array of WideChar;
  8.   CharPlaceInfo: GCP_RESULTSW;
  9.   {$ENDIF}
  10. begin
  11.   if AnEto <> nil then
  12.     EtoArray := AnEto.Eto
  13.   else
  14.     EtoArray := nil;
  15.  

Remove the if condition and just keep "EtoArray := nil;"
9
SetHeight and SetWidth works. If there is a calculation issue, it is not significant.
The problem is that they do not work from the first time.
I am not sure that the problem is rooted in TAChart, or there is something else.
Maybe GetWidth gets executed before TAChart performs the calculations.

But if it was the case, maybe TWaveformGraph(FParent).Chart.Invalidate; should solve the issues but it does not.
Code: Pascal  [Select][+][-]
  1. function TPlotAreaSize.GetWidth: integer;
  2. begin
  3.  //TWaveformGraph(FParent).Chart.Invalidate; //This line does not help
  4.   Result := TWaveformGraph(FParent).Chart.ClipRect.Width;
  5. end;



As I said, a Showmessage ('SetWidth') in the end of SetWidth solves the issue, unfortunately, the control is not usable with a Showmessage.

A Sleep() does not help.
So I guess that Showmessage forces some update of the IDE, and if I can force it another way, this could be the solution.
10
Cocoa / CocoaInt.CocoaIconUse no longer recognized?
« Last post by MISV on Today at 11:51:28 am »
Hi,

I can see

Code: Pascal  [Select][+][-]
  1. CocoaInt.CocoaIconUse := True;

now gives error

Quote
Idenfier not found CocoaIconUse


Has this been deprecated since removed? (Using recent stable build as downloaded by FPCUpDeluxe)
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018