Jump to content

A.M. Hoornweg

Members
  • Content Count

    489
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by A.M. Hoornweg

  1. A.M. Hoornweg

    fmxLinux missing?

    I have updated my Delphi 12.1 Enterprise to version 12.2, selecting the Windows, Android and Linux platforms in the installer. But the Linux platform seems to be missing in the IDE and fmxLinux is unavailable in GetIt. Am I missing something?
  2. If the problem is just that the cdecl function needs to be in an external module, maybe it's possible to work around that. It may sound counter-intuitive, but it's perfectly possible to export a function contained in an *.exe project and then call it from a DLL loaded by the executable. I see no reason why the executable shouldn't be allowed to import a function that it exports itself. Program test; uses windows; function somefunction:integer; cdecl; export; begin result:=1; outputdebugstring(pchar('Hello World')); end; Exports somefunction; end;
  3. One advantage is that it's way less work server-side. If anything goes wrong, you need not worry too much about how to inform the client because that information is already contained in the exception that was thrown by whatever action failed. The stack is unrolled automatically just like in regular Delphi apps and the exception information is automatically propagated to the client. Client-side, a remote procedure call is used like any other Delphi call. In the case of an error, you use structured exception handling and use the exception type as a criterium for how the client should proceed. try server.executequery(query) except on e:exception do begin if e is eCommsError then //did the internet connection fail? If so, client should try again later. ... else if e is eDatabaseError then showmessage(format('The server really didn''t like this query, this is wrong with it: (%s) "%s"',[e.classname, e.message])) else ... end; end;
  4. The disadvantage of that is that it doesn't tell you in detail what went wrong on the server. It is also tedious, the server needs to CATCH exceptions and convert them into something meaningful (an error code?) to pass back to the client, hopefully yielding sufficient information. If the framework itself is designed in such a way that it can pass exceptions back from server to client, the client will re-raise the same exception type (eOverflow, eConvertError, eInOutError, eListError...) with (hopefully) the server's error address in the error message so you can easily find the root cause. It also simplifies server-side development enormously; if something goes wrong on the server, it can simply raise an exception and it will be passed back to the client.
  5. I use Remobjects Remoting SDK as a middleware and that is perfectly capable of passing an exception that happens in a remote procedure call back to the client without hanging. The exception is then raised in the client.
  6. Hello World, does anyone know of an IDE plugin or other tool that will analyze the interface section of a unit and expand the unit names with their full namespaces, such as "rtl, vcl, db" etc ? Thanks in advance!
  7. A.M. Hoornweg

    Plugin to expand namespaces in DCU?s?

    Thank you very much!
  8. A.M. Hoornweg

    Plugin to expand namespaces in DCU?s?

    I use MMX code explorer but I can't find the option to do this, can you point me to it? Thanks in advance!
  9. Please try to disable "code inlining control" in the compiler settings and see if the problem disappears.
  10. A.M. Hoornweg

    Linker error L902

    Hello all, I have ported a large project (32-bit, 1.4 million LOC) from Delphi 11 to Delphi 12 (enterprise). Performing a "full build" works fine, but a "make" produces linker error L902 every time; now just imagine you're debugging something and have to do a full build all the time. It's simply no fun. I have never had this problem in Delphi 11. Is there any way I can circumvent this problem ?
  11. A.M. Hoornweg

    Linker error L902

    FOUND! The L902 linker error disappears if I set the compiler switch "code inlining control" to OFF! I can reproduce this in several 32-bit programs that had this problem. Kudos to my colleague Ralf Claussen who discovered this by chance.
  12. A.M. Hoornweg

    What new features would you like to see in Delphi 13?

    I want "F2084 Internal Error L902" gone !!!
  13. A.M. Hoornweg

    Reduce exe weight : Link with runtime package

    What are you talking about??? I'm not compressing any EXEs. I'm just preventing that 30-40% of unused stuff gets linked into them (it would be nice if Delphi's linker had such an option). And of course I use highly compressed setups.
  14. A.M. Hoornweg

    Reduce exe weight : Link with runtime package

    I have *always* used installers. Nowadays executable size is not much of an issue anymore, thanks to better networks. But in a not so distant past I had to regularly push software updates to locations that were using T&T Inmarsat Mini-M satellite terminals. Imagine the slowest and most expensive connection imaginable, 2400 bps, costing like 5 euros per minute. I'm glad those days are over.
  15. A.M. Hoornweg

    Reduce exe weight : Link with runtime package

    It adds up in some projects consisting of dozens of dlls and executables. I had to cope with deployment over slow connections paid by data volume until quite recently.
  16. A.M. Hoornweg

    Reduce exe weight : Link with runtime package

    The problem with using UPX is the following. Normally Windows would open an executable file using a "memory mapped file" mechanism instead of bluntly allocating memory and loading the contents. This allows the Windows virtual memory manager to efficiently "page in" sections of the executable as needed (on demand paging), improving performance and minimizing memory use. If the file is compressed using UPX, execution starts in the UPX loader stub which immediately allocates a big block of memory and extracts the executable into that before proceeding with the "real" execution. This simply wastes precious resources.
  17. A.M. Hoornweg

    Reduce exe weight : Link with runtime package

    I have made an application that copies the Delphi RTL/VCL source files into a temporary folder, inserts the text '{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}' in the right places and re-builds the whole lot. The compiled *.dcu files contain a lot less RTTI than before. By linking against this compacted RTL I achieve a size reduction in a 64-bit VCL application from 14 MB to 10.3 MB using Delphi 12. For just a single executable that isn't worthwhile, but I use this in some multi-module projects that consist of a few dozen ActiveX EXE's and DLL'S. There the cumulative size reduction is substantial. Proper testing is hugely important, one has to be sure that the missing RTTI doesn't cause the program to malfunction.
  18. A.M. Hoornweg

    DLL Load Issue

    In that case it may have to do with the changed FPU flags behavior in Delphi 12. Try doing this right before calling your DLL, does it make a difference? SetFPUMask([exdenormalized, exunderflow, exprecision]); This setting makes the FPU behave like in previous Delphi versions. In other words, a FP division by 0 will generate an exception instead of continuing the code path with a NAN result.
  19. A.M. Hoornweg

    DLL Load Issue

    Please verify if "sizeof (tViewerParams)" gives the same result in all compilers. Also, is the calling convention to the dll function declared identically and clearly in all projects (e.g. "stdcall") ?
  20. A.M. Hoornweg

    DLL Load Issue

    The thing that may bite you here is field alignment. The compiler that created the DLL and the compiler that created the *.exe must use identical settings for field alignment so they expect the members of the record at identical offsets. see https://docwiki.embarcadero.com/RADStudio/Athens/en/Align_fields_(Delphi)
  21. A.M. Hoornweg

    DLL Load Issue

    @StephenM: You write "It ingests a data structure that identifies a report". Please be aware that there are strict limitations about what data types you can safely pass between the exe <--> dll boundary. Can you describe what this data structure looks like?
  22. Hello all, I saw how FreeAndNil is implemented in the RTL using a "CONST [ref]" parameter and then a little "tweak" is used to NIL the variable being referenced. I wondered why the heck the object wasn't simply passed as a VAR parameter in the first place. Until I tried that out and found that it wouldn't compile. Delphi insists that you either pass the exact object type or use a typecast. What I don't understand is the reason why Delphi is so strict here; if a class derives from tObject, it still has all the original stuff in place from its ancestor so you can't really "break" anything by treating it as a tObject, so why is Delphi so strict? It feels counter-intuitive. Type tBase=Class(tObject) procedure test; end; Procedure tBase.Test; begin // end; Procedure MyFreeAndNil(VAR obj: tObject); begin obj.free; obj:=Nil; end; procedure test; var t:tbase; begin t:=tbase.create; MyFreeAndNil(t); end;
  23. A.M. Hoornweg

    Double, default value

    Just declare class procedure MyFormShow(Sender: TObject); STATIC; That way the method does not have a hidden "self" parameter. Having no "self" parameter turns the class method into a regular procedure inside the namespace tTest (it is no longer a "procedure of object"). Static class methods are unable to access any members or methods that require a "self" parameter.
  24. A.M. Hoornweg

    Double, default value

    I for one would find it an advantage if stuff like local pointer variables would default to NIL, it would make the language just a little bit more memory safe.
×